<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  <!-- 谷歌收录 -->
  <meta name="google-site-verification" content="-5hl8eC4wfapGZhZouwMVUcKG0iaynijVRJbqVlzXm4" />
  
  
  <title>Hadoop集群搭建详细步骤 | 鴻塵</title>
  <meta name="description" content="摘要：史上最详细的Hadoop-Spark集群搭建采坑过程，包括VMware、Linux-CentOS-7、Java&#x2F;JDK、Hadoop、Scala以及Spark的安装配置，图文并茂，每一个坑都填满。">
<meta property="og:type" content="article">
<meta property="og:title" content="Hadoop集群搭建详细步骤">
<meta property="og:url" content="https://hwame.top/20200522/bigdata-cluster-with-hadoop-scala-spark.html">
<meta property="og:site_name" content="鴻塵">
<meta property="og:description" content="摘要：史上最详细的Hadoop-Spark集群搭建采坑过程，包括VMware、Linux-CentOS-7、Java&#x2F;JDK、Hadoop、Scala以及Spark的安装配置，图文并茂，每一个坑都填满。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image001.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image002.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image003.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image004.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image005.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image006.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image007.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image008.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image009.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image010.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image011.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image012.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image013.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image014.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image015.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image016.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image017.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image018.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image019.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image020.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image021.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image022.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image023.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image024.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image025.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image026.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image027.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image028.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image029.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image030.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image031.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image032.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image033.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image034.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image035.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image036.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image037.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image038.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image039.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image040.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image041.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image042.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image043.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image044.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image045.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image046.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image047.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image048.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image049.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image050.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image051.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image052.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image053.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image054.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image055.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image056.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image057.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image058.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image059.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image060.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image061.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image062.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image063.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image064.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image065.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image066.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image067.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image068.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image069.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image070.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image071.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image072.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image073.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image074.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image075.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image076.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image077.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image078.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image079.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image080.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image081.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image082.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image083.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image084.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image085.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image086.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image087.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image088.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image089.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image090.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image091.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image092.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image093.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image094.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image095.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image096.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image097.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image098.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image099.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image100.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image101.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image102.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image103.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image104.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image105.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image106.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image107.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image108.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image109.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image110.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image111.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image112.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image113.png">
<meta property="article:published_time" content="2020-05-22T09:04:39.000Z">
<meta property="article:modified_time" content="2020-05-28T01:36:41.000Z">
<meta property="article:author" content="鴻塵">
<meta property="article:tag" content="Spark">
<meta property="article:tag" content="大数据">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image001.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://hwame.top/20200522/bigdata-cluster-with-hadoop-scala-spark.html">
  
    <link rel="alternate" href="true" title="鴻塵" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/css/style.css">

  
  
  
    <link href="//cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css" rel="stylesheet">
  
  
<meta name="generator" content="Hexo 5.4.2"></head>


<script src="https://cdn.jsdelivr.net/gh/bobcn/hexo_resize_image.js@master/hexo_resize_image.js"></script>
<body class="main-center theme-purple" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://hwame.top" target="_blank">
          <img class="img-circle img-rotate" src="https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">鴻塵</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Pythoner, Data Analyst</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> 湖北-武汉</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav menu-highlight">
        
        
        <li class="menu-item menu-item-home">
          <a href="/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/categories">
            
            <i class="icon icon-folder-open"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">资源</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-gallery">
          <a href="/gallery">
            
            <i class="icon icon-delicious"></i>
            
            <span class="menu-title">相册</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-links">
          <a href="/links">
            
            <i class="icon icon-friendship"></i>
            
            <span class="menu-title">友链</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/hwame" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/hwamei" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://www.zhihu.com/people/hwame" target="_blank" title="Zhihu" data-toggle=tooltip data-placement=top><i class="icon icon-zhihu"></i></a></li>
        
        <li><a href="https://segmentfault.com/u/hwame" target="_blank" title="Segmentfault" data-toggle=tooltip data-placement=top><i class="icon icon-segmentfault"></i></a></li>
        
        <li><a href="https://gitee.com/hwame" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-stackexchange"></i>公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎来到鴻塵的博客!<br>鴻塵的<u><a target="_blank" rel="noopener" href="https://weibo.com/hwamei" style="color:#E541E5;">微博</a></u>主页，鴻塵的<u><a target="_blank" rel="noopener" href="https://github.com/hwame" style="color:#E541E5;">Github</a></u>主页，如果我可以忘记的<u><a target="_blank" rel="noopener" href="https://www.zhihu.com/people/hwame" style="color:#E541E5;">知乎</a></u>主页。</p>
            </div>
        </div>
    </div>
</div>

    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-tags"></i>标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/tags/CentOS/" style="font-size: 13px; color: #fff">CentOS</a> <a href="/tags/Go/" style="font-size: 13.2px; color: #fff">Go</a> <a href="/tags/Hexo/" style="font-size: 13.8px; color: #fff">Hexo</a> <a href="/tags/Linux/" style="font-size: 14px; color: #fff">Linux</a> <a href="/tags/Linux%E9%83%A8%E7%BD%B2/" style="font-size: 13px; color: #fff">Linux部署</a> <a href="/tags/MongoDB/" style="font-size: 13.4px; color: #fff">MongoDB</a> <a href="/tags/Spark/" style="font-size: 13px; color: #fff">Spark</a> <a href="/tags/matplotlib/" style="font-size: 13.2px; color: #fff">matplotlib</a> <a href="/tags/miscellanea/" style="font-size: 13.6px; color: #fff">miscellanea</a> <a href="/tags/python/" style="font-size: 14px; color: #fff">python</a> <a href="/tags/shell/" style="font-size: 13.6px; color: #fff">shell</a> <a href="/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/" style="font-size: 13px; color: #fff">大数据</a> <a href="/tags/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/" style="font-size: 13px; color: #fff">数据结构与算法</a> <a href="/tags/%E7%88%AC%E8%99%AB/" style="font-size: 13px; color: #fff">爬虫</a>
    </div>
  </div>

<script type="text/javascript">
    var everytag=document.getElementsByClassName("widget-body tagcloud")[0].children;
    for (var i = everytag.length - 1; i >= 0; i--) {
    	var r=Math.floor(Math.random()*255);
        var g=Math.floor(Math.random()*255);
        var b=Math.floor(Math.random()*255);
        everytag[i].style.background = "rgb("+r+","+g+","+b+")";
    }
</script>
    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-folder-open"></i>分类</h3>
    <div class="widget-body">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Go/">Go</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Hexo/">Hexo</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/MongoDB/">MongoDB</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/miscellanea/">miscellanea</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/python/">python</a><span class="category-list-count">7</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/">数据结构与算法</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-archives-fill"></i>归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/">2022</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/">2021</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/">2020</a><span class="archive-list-count">17</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-shu-fill"></i>最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled ">
        
          <li>
            
            <div class="item-thumb">
              <a href="/20220327/channel-and-goroutine-in-go.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/icon-golang.jpeg)" alt="Go语言中的通道" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Go/">Go</a>
              </p>
              <p class="item-title">
                <a href="/20220327/channel-and-goroutine-in-go.html" class="title">Go语言中的通道</a>
              </p>
              <p class="item-date">
                <time datetime="2022-03-27T11:06:16.000Z" itemprop="datePublished">2022-03-27</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220323/when-to-use-pointer-in-go.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/icon-golang.jpeg)" alt="Go语言什么时候使用指针" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Go/">Go</a>
              </p>
              <p class="item-title">
                <a href="/20220323/when-to-use-pointer-in-go.html" class="title">Go语言什么时候使用指针</a>
              </p>
              <p class="item-date">
                <time datetime="2022-03-23T12:49:57.000Z" itemprop="datePublished">2022-03-23</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220228/awesome-images-in-markdown.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg)" alt="Markdown中图片的高级用法" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/miscellanea/">miscellanea</a>
              </p>
              <p class="item-title">
                <a href="/20220228/awesome-images-in-markdown.html" class="title">Markdown中图片的高级用法</a>
              </p>
              <p class="item-date">
                <time datetime="2022-02-28T15:27:50.000Z" itemprop="datePublished">2022-02-28</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220116/shell-regular-expression.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/linux-icon.png)" alt="Shell正则表达式" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Linux/">Linux</a>
              </p>
              <p class="item-title">
                <a href="/20220116/shell-regular-expression.html" class="title">Shell正则表达式</a>
              </p>
              <p class="item-date">
                <time datetime="2022-01-16T14:13:05.000Z" itemprop="datePublished">2022-01-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20211009/install-linux-on-android-phone.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg)" alt="如何在安卓手机上安装Linux发行版" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/miscellanea/">miscellanea</a>
              </p>
              <p class="item-title">
                <a href="/20211009/install-linux-on-android-phone.html" class="title">如何在安卓手机上安装Linux发行版</a>
              </p>
              <p class="item-date">
                <time datetime="2021-10-09T15:16:37.000Z" itemprop="datePublished">2021-10-09</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <nav id="toc" class="article-toc">
      <h3 class="toc-title">文章目录</h3>
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-%E6%A6%82%E8%BF%B0"><span class="toc-number">1.</span> <span class="toc-text">1.概述</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-1-%E8%BD%AF%E4%BB%B6%E7%8E%AF%E5%A2%83"><span class="toc-number">1.1.</span> <span class="toc-text">1.1.软件环境</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2-%E5%AE%89%E8%A3%85VMware-Workstation"><span class="toc-number">2.</span> <span class="toc-text">2.安装VMware Workstation</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#3-%E7%BD%91%E7%BB%9C%E9%85%8D%E7%BD%AE%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="toc-number">3.</span> <span class="toc-text">3.网络配置准备工作</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#3-1-VMware%E8%AE%BE%E7%BD%AE"><span class="toc-number">3.1.</span> <span class="toc-text">3.1.VMware设置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-2-%E6%8E%A7%E5%88%B6%E9%9D%A2%E6%9D%BF%E7%BD%91%E7%BB%9C%E8%AE%BE%E7%BD%AE"><span class="toc-number">3.2.</span> <span class="toc-text"> 3.2.控制面板网络设置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-1-%E6%9F%A5%E7%9C%8B%E7%BD%91%E5%8D%A1"><span class="toc-number">3.2.1.</span> <span class="toc-text">3.2.1.查看网卡</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-2-%E9%85%8D%E7%BD%AE%E8%99%9A%E6%8B%9F%E7%BD%91%E5%8D%A1VMnet8"><span class="toc-number">3.2.2.</span> <span class="toc-text">3.2.2.配置虚拟网卡VMnet8</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-3-%E6%9F%A5%E7%9C%8B%E7%89%A9%E7%90%86%E4%B8%BB%E6%9C%BA%E4%BF%A1%E6%81%AF"><span class="toc-number">3.3.</span> <span class="toc-text">3.3.查看物理主机信息</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#4-%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">4.</span> <span class="toc-text">4.安装虚拟机</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#4-1-%E5%AE%89%E8%A3%85Master"><span class="toc-number">4.1.</span> <span class="toc-text">4.1.安装Master</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-1-%E8%AF%B4%E6%98%8E"><span class="toc-number">4.1.1.</span> <span class="toc-text">4.1.1.说明</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-2-%E6%96%B0%E5%BB%BA%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">4.1.2.</span> <span class="toc-text">4.1.2.新建虚拟机</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-3-%E5%AE%89%E8%A3%85%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">4.1.3.</span> <span class="toc-text">4.1.3.安装虚拟机</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-4-%E9%85%8D%E7%BD%AEMaster%E7%BD%91%E7%BB%9C"><span class="toc-number">4.1.4.</span> <span class="toc-text">4.1.4.配置Master网络</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-5-%E8%AE%BE%E7%BD%AEroot%E5%AF%86%E7%A0%81"><span class="toc-number">4.1.5.</span> <span class="toc-text">4.1.5.设置root密码</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-2-%E5%AE%89%E8%A3%85Slave1"><span class="toc-number">4.2.</span> <span class="toc-text">4.2.安装Slave1</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-3-%E5%AE%89%E8%A3%85Slave2"><span class="toc-number">4.3.</span> <span class="toc-text"> 4.3.安装Slave2</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#5-%E8%99%9A%E6%8B%9F%E6%9C%BA%E9%85%8D%E7%BD%AE"><span class="toc-number">5.</span> <span class="toc-text"> 5.虚拟机配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#5-1-%E8%AE%BE%E7%BD%AE%E5%90%84%E8%8A%82%E7%82%B9%E5%90%8D%E7%A7%B0"><span class="toc-number">5.1.</span> <span class="toc-text">5.1.设置各节点名称</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-2-%E9%85%8D%E7%BD%AEhosts"><span class="toc-number">5.2.</span> <span class="toc-text">5.2.配置hosts</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-3-%E9%85%8D%E7%BD%AE%E5%90%84%E8%8A%82%E7%82%B9%E7%BD%91%E5%8D%A1"><span class="toc-number">5.3.</span> <span class="toc-text">5.3.配置各节点网卡</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-4-%E5%85%B3%E9%97%AD%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-number">5.4.</span> <span class="toc-text"> 5.4.关闭防火墙</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#5-4-1-%E4%BB%A5Tester%E4%B8%BA%E4%BE%8B"><span class="toc-number">5.4.1.</span> <span class="toc-text">5.4.1.以Tester为例</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-4-2-Master%E5%85%B3%E9%97%AD%E9%98%B2%E7%81%AB%E5%A2%99%E6%88%AA%E5%9B%BE"><span class="toc-number">5.4.2.</span> <span class="toc-text">5.4.2.Master关闭防火墙截图</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-5-%E4%BA%92ping%E6%B5%8B%E8%AF%95"><span class="toc-number">5.5.</span> <span class="toc-text">5.5.互ping测试</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#5-5-1-Windows%E7%89%A9%E7%90%86%E4%B8%BB%E6%9C%BA"><span class="toc-number">5.5.1.</span> <span class="toc-text">5.5.1.Windows物理主机</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-5-2-Mater%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">5.5.2.</span> <span class="toc-text">5.5.2.Mater虚拟机</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-5-3-Slave1%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">5.5.3.</span> <span class="toc-text">5.5.3.Slave1虚拟机</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-5-4-Slave2%E8%99%9A%E6%8B%9F%E6%9C%BA"><span class="toc-number">5.5.4.</span> <span class="toc-text">5.5.4.Slave2虚拟机</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#6-JDK%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE"><span class="toc-number">6.</span> <span class="toc-text">6.JDK的安装与配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#6-1-%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AE%89%E8%A3%85JDK%E5%8F%8A%E5%8D%B8%E8%BD%BD"><span class="toc-number">6.1.</span> <span class="toc-text">6.1.检查是否已安装JDK及卸载</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-2-Master%E5%AE%89%E8%A3%85JDK"><span class="toc-number">6.2.</span> <span class="toc-text">6.2.Master安装JDK</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-1-%E6%9F%A5%E7%9C%8BJDK%E8%BD%AF%E4%BB%B6%E5%8C%85%E5%88%97%E8%A1%A8"><span class="toc-number">6.2.1.</span> <span class="toc-text">6.2.1.查看JDK软件包列表</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-2%E5%AE%89%E8%A3%85openjdk"><span class="toc-number">6.2.2.</span> <span class="toc-text">6.2.2安装openjdk</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-3-%E6%9F%A5%E7%9C%8B%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%85%E6%88%90%E5%8A%9F"><span class="toc-number">6.2.3.</span> <span class="toc-text">6.2.3.查看是否安装成功</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-4-%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">6.2.4.</span> <span class="toc-text">6.2.4.配置环境变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-3-Slave1%E5%92%8CSlave2%E5%AE%89%E8%A3%85JDK"><span class="toc-number">6.3.</span> <span class="toc-text">6.3.Slave1和Slave2安装JDK</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#7-%E9%85%8D%E7%BD%AESSH%E5%85%8D%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95"><span class="toc-number">7.</span> <span class="toc-text">7.配置SSH免密码登录</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#7-1-%E5%BC%80%E5%90%AFsshd%E5%AF%86%E9%92%A5%E8%AE%A4%E8%AF%81"><span class="toc-number">7.1.</span> <span class="toc-text">7.1.开启sshd密钥认证</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-2-%E5%88%9B%E5%BB%BA%E5%85%8D%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95%E8%B4%A6%E6%88%B7"><span class="toc-number">7.2.</span> <span class="toc-text">7.2.创建免密码登录账户</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-3-%E7%94%9F%E6%88%90%E5%85%AC%E9%92%A5%E5%AF%86%E9%92%A5%E5%AF%B9"><span class="toc-number">7.3.</span> <span class="toc-text">7.3.生成公钥密钥对</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-4-%E5%B0%86%E5%85%AC%E9%92%A5%E5%AF%BC%E5%85%A5%E8%AE%A4%E8%AF%81%E6%96%87%E4%BB%B6"><span class="toc-number">7.4.</span> <span class="toc-text">7.4.将公钥导入认证文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-5-%E8%AE%BE%E7%BD%AE%E6%9D%83%E9%99%90%E5%B9%B6%E8%A1%A5%E5%85%A8Master%E4%BF%A1%E6%81%AF"><span class="toc-number">7.5.</span> <span class="toc-text">7.5.设置权限并补全Master信息</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-6-%E5%B0%86%E8%AE%A4%E8%AF%81%E6%96%87%E4%BB%B6%E5%A4%8D%E5%88%B6%E5%88%B0slave%E8%8A%82%E7%82%B9"><span class="toc-number">7.6.</span> <span class="toc-text">7.6.将认证文件复制到slave节点</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-7-%E8%AE%BE%E7%BD%AE%E4%BB%8E%E8%8A%82%E7%82%B9%E8%AE%A4%E8%AF%81%E6%96%87%E4%BB%B6%E6%9D%83%E9%99%90"><span class="toc-number">7.7.</span> <span class="toc-text">7.7.设置从节点认证文件权限</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-8-%E4%B8%89%E8%8A%82%E7%82%B9%E4%BA%92%E7%9B%B8ssh%E7%99%BB%E9%99%86%E6%B5%8B%E8%AF%95"><span class="toc-number">7.8.</span> <span class="toc-text">7.8.三节点互相ssh登陆测试</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#8-%E5%AE%89%E8%A3%85Hadoop"><span class="toc-number">8.</span> <span class="toc-text">8.安装Hadoop</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#8-1-%E4%B8%8B%E8%BD%BD%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="toc-number">8.1.</span> <span class="toc-text">8.1.下载压缩包</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-2-%E8%A7%A3%E5%8E%8BHadoop%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="toc-number">8.2.</span> <span class="toc-text">8.2.解压Hadoop压缩包</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-3-%E6%9B%B4%E6%94%B9%E7%94%A8%E6%88%B7%E7%BB%84"><span class="toc-number">8.3.</span> <span class="toc-text">8.3.更改用户组</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-4-%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">8.4.</span> <span class="toc-text">8.4.配置环境变量</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-5-%E5%AE%9E%E9%99%85%E5%AE%89%E8%A3%85Hadoop%E7%9A%84%E8%AF%B4%E6%98%8E"><span class="toc-number">8.5.</span> <span class="toc-text">8.5.实际安装Hadoop的说明</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#8-5-1-%E5%AE%89%E8%A3%85%E4%BD%8D%E7%BD%AE%E7%9A%84%E9%97%AE%E9%A2%98"><span class="toc-number">8.5.1.</span> <span class="toc-text">8.5.1.安装位置的问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-5-2%E8%A7%A3%E5%86%B3%E5%AE%89%E8%A3%85%E4%BD%8D%E7%BD%AE%E7%9A%84%E9%97%AE%E9%A2%98"><span class="toc-number">8.5.2.</span> <span class="toc-text">8.5.2解决安装位置的问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-5-3-%E5%90%84%E4%B8%AA%E8%8A%82%E7%82%B9"><span class="toc-number">8.5.3.</span> <span class="toc-text">8.5.3.各个节点</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-5-4-%E4%BB%8E%E8%8A%82%E7%82%B9Hadoop%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-number">8.5.4.</span> <span class="toc-text">8.5.4.从节点Hadoop的安装</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#9-%E9%85%8D%E7%BD%AEHadoop%E9%9B%86%E7%BE%A4"><span class="toc-number">9.</span> <span class="toc-text">9.配置Hadoop集群</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#9-1-%E9%85%8D%E7%BD%AEcore-site-xml"><span class="toc-number">9.1.</span> <span class="toc-text">9.1.配置core-site.xml</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-2-%E9%85%8D%E7%BD%AEhdfs-site-xml"><span class="toc-number">9.2.</span> <span class="toc-text">9.2.配置hdfs-site.xml</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-3-%E9%85%8D%E7%BD%AEmapred-site-xml"><span class="toc-number">9.3.</span> <span class="toc-text">9.3.配置mapred-site.xml</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-4-%E9%85%8D%E7%BD%AEyarn-site-xml"><span class="toc-number">9.4.</span> <span class="toc-text">9.4.配置yarn-site.xml</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-5-%E9%85%8D%E7%BD%AEslaves"><span class="toc-number">9.5.</span> <span class="toc-text">9.5.配置slaves</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-6-%E9%85%8D%E7%BD%AEhadoop-env-sh"><span class="toc-number">9.6.</span> <span class="toc-text">9.6.配置hadoop-env.sh</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-7-%E5%B0%86%E9%85%8D%E7%BD%AE%E5%88%86%E5%8F%91%E5%88%B0%E5%85%B6%E4%BB%96%E8%8A%82%E7%82%B9"><span class="toc-number">9.7.</span> <span class="toc-text">9.7.将配置分发到其他节点</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#10-%E6%93%8D%E4%BD%9CHadoop%E9%9B%86%E7%BE%A4"><span class="toc-number">10.</span> <span class="toc-text">10.操作Hadoop集群</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#10-1-%E6%A0%BC%E5%BC%8F%E5%8C%96NameNode"><span class="toc-number">10.1.</span> <span class="toc-text">10.1.格式化NameNode</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#10-2-%E5%90%AF%E5%8A%A8HDFS%E9%9B%86%E7%BE%A4"><span class="toc-number">10.2.</span> <span class="toc-text">10.2.启动HDFS集群</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#10-3-%E5%90%AF%E5%8A%A8YARN"><span class="toc-number">10.3.</span> <span class="toc-text">10.3.启动YARN</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#11-%E5%90%84%E8%8A%82%E7%82%B9scala%E5%AE%89%E8%A3%85"><span class="toc-number">11.</span> <span class="toc-text">11.各节点scala安装</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#11-1-%E4%B8%BB%E8%8A%82%E7%82%B9Master%E4%B8%8A%E5%AE%89%E8%A3%85scala"><span class="toc-number">11.1.</span> <span class="toc-text">11.1.主节点Master上安装scala</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#11-1-1%E4%B8%8B%E8%BD%BDscala"><span class="toc-number">11.1.1.</span> <span class="toc-text">11.1.1下载scala</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-1-2%E8%A7%A3%E5%8E%8Bscala%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="toc-number">11.1.2.</span> <span class="toc-text">11.1.2解压scala压缩包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-1-3%E9%85%8D%E7%BD%AEscala%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">11.1.3.</span> <span class="toc-text">11.1.3配置scala环境变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#11-2%E4%BB%8E%E8%8A%82%E7%82%B9%E4%B8%8A%E5%AE%89%E8%A3%85scala"><span class="toc-number">11.2.</span> <span class="toc-text">11.2从节点上安装scala</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#11-2-1-scp%E4%BC%A0%E8%BE%93scala%E5%AE%89%E8%A3%85%E6%96%87%E4%BB%B6"><span class="toc-number">11.2.1.</span> <span class="toc-text">11.2.1.scp传输scala安装文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-2-2%E9%85%8D%E7%BD%AE%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">11.2.2.</span> <span class="toc-text">11.2.2配置环境变量</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#12-Spark%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE"><span class="toc-number">12.</span> <span class="toc-text">12.Spark安装及配置</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#12-1-%E4%B8%BB%E8%8A%82%E7%82%B9Master%E4%B8%8A%E5%AE%89%E8%A3%85spark"><span class="toc-number">12.1.</span> <span class="toc-text">12.1.主节点Master上安装spark</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1-1%E4%B8%8B%E8%BD%BDspark%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="toc-number">12.1.1.</span> <span class="toc-text">12.1.1下载spark压缩包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1-2-%E8%A7%A3%E5%8E%8Bspark%E5%8E%8B%E7%BC%A9%E5%8C%85"><span class="toc-number">12.1.2.</span> <span class="toc-text">12.1.2.解压spark压缩包</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1-3-%E4%BF%AE%E6%94%B9spark%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">12.1.3.</span> <span class="toc-text">12.1.3.修改spark配置文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1-4-%E4%BF%AE%E6%94%B9slaves%E6%96%87%E4%BB%B6"><span class="toc-number">12.1.4.</span> <span class="toc-text">12.1.4.修改slaves文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-1-5-%E9%85%8D%E7%BD%AEspark%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">12.1.5.</span> <span class="toc-text">12.1.5.配置spark环境变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#12-2-%E4%BB%8E%E8%8A%82%E7%82%B9%E4%B8%8A%E5%AE%89%E8%A3%85spark"><span class="toc-number">12.2.</span> <span class="toc-text">12.2.从节点上安装spark</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#12-2-1-scp%E4%BC%A0%E8%BE%93spark%E5%AE%89%E8%A3%85%E6%96%87%E4%BB%B6"><span class="toc-number">12.2.1.</span> <span class="toc-text">12.2.1.scp传输spark安装文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-2-2-%E9%85%8D%E7%BD%AEspark%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-number">12.2.2.</span> <span class="toc-text">12.2.2.配置spark环境变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#12-3-%E4%BF%AE%E6%94%B9spark-env-sh"><span class="toc-number">12.3.</span> <span class="toc-text">12.3.修改spark-env.sh</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#13-%E5%90%AF%E5%8A%A8Spark%E9%9B%86%E7%BE%A4"><span class="toc-number">13.</span> <span class="toc-text">13.启动Spark集群</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#13-1-%E8%AF%B4%E6%98%8E"><span class="toc-number">13.1.</span> <span class="toc-text">13.1.说明</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#13-2-%E6%9B%B4%E6%94%B9Scala%E5%92%8CSpark%E7%9A%84%E7%94%A8%E6%88%B7%E7%BB%84"><span class="toc-number">13.2.</span> <span class="toc-text">13.2.更改Scala和Spark的用户组</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#13-2-1-%E4%B8%BB%E8%8A%82%E7%82%B9Master"><span class="toc-number">13.2.1.</span> <span class="toc-text">13.2.1.主节点Master</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13-2-2-%E4%BB%8E%E8%8A%82%E7%82%B9Slave1"><span class="toc-number">13.2.2.</span> <span class="toc-text">13.2.2.从节点Slave1</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13-2-3-%E4%BB%8E%E8%8A%82%E7%82%B9Slave2"><span class="toc-number">13.2.3.</span> <span class="toc-text">13.2.3.从节点Slave2</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#13-3-%E5%90%AF%E5%8A%A8Hadoop%E9%9B%86%E7%BE%A4"><span class="toc-number">13.3.</span> <span class="toc-text">13.3.启动Hadoop集群</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#13-4-%E5%90%AF%E5%8A%A8Spark%E9%9B%86%E7%BE%A4"><span class="toc-number">13.4.</span> <span class="toc-text">13.4.启动Spark集群</span></a></li></ol></li></ol>
    </nav>
  </div>
</aside>

<main class="main" role="main">
  <div class="content">
  <article id="post-bigdata-cluster-with-hadoop-scala-spark" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      Hadoop集群搭建详细步骤
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar"></i>
	<a href="/20200522/bigdata-cluster-with-hadoop-scala-spark.html" class="article-date">
	  发布于 <time datetime="2020-05-22T09:04:39.000Z" itemprop="datePublished">2020-05-22</time>
	</a>
</span>
<span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/20200522/bigdata-cluster-with-hadoop-scala-spark.html" class="article-date">
	  更新于 <time datetime="2020-05-28T01:36:41.000Z" itemprop="dateUpdated">2020-05-28</time>
	</a>
</span>
        
  <span class="article-category">
    <i class="icon icon-folder"></i>
    <a class="article-category-link" href="/categories/Linux/">Linux</a>
  </span>

        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link-link" href="/tags/Spark/" rel="tag">Spark</a>, <a class="article-tag-link-link" href="/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/" rel="tag">大数据</a>
  </span>


        

	<span class="article-read hidden-xs">
    	<i class="icon icon-eye-fill" aria-hidden="true"></i>
    	<span id="/20200522/bigdata-cluster-with-hadoop-scala-spark.html" class="leancloud_visitors"  data-flag-title="Hadoop集群搭建详细步骤">
			<span class="leancloud-visitors-count">0</span>
		</span>
    </span>

        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/20200522/bigdata-cluster-with-hadoop-scala-spark.html#comments" class="article-comment-link">评论</a></span>
        
	
		<span class="post-wordcount hidden-xs" itemprop="wordCount">字数统计: 13k(字)</span>
	
	
		<span class="post-readcount hidden-xs" itemprop="timeRequired">阅读时长: 56(分)</span>
	

      </div>
      <div style="background-color:#D7BDE2;border:1px solid #D7BDE2;border-radius:10px;padding:5px">
          <b>温馨提示</b>：点击页面下方<i style="color:red" class="icon icon-anchor"></i>以展开或折叠目录
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <p>摘要：史上最详细的<code>Hadoop-Spark</code>集群搭建采坑过程，包括<code>VMware</code>、<code>Linux-CentOS-7</code>、<code>Java/JDK</code>、<code>Hadoop</code>、<code>Scala</code>以及<code>Spark</code>的安装配置，图文并茂，每一个坑都填满。<span id="more"></span></p>
<blockquote>
<p><font size=5><b>文章说明</b></font><br><strong>文章来源：</strong>本文由<code>Word</code>文件转换而来，因此保留了原始样式，字体为<code>宋体</code>＋<code>Times New Roman</code>＋<code>Consolas</code>。<br><strong>文章说明：</strong>史上最详细的<code>Hadoop</code>集群搭建过程，包括<code>VMware</code>、<code>Linux-CentOS-7</code>、<code>Java/JDK</code>、<code>Hadoop</code>、<code>Scala</code>，以及<code>Spark</code>。原文共<code>87</code>页，字数共<code>12497</code>，合计<code>29460</code>字符，<code>13</code>章，段落数<code>865</code>，行数<code>1335</code>行，图片共<code>113</code>张。本文源码<code>MarkDown</code>文件字数共计<code>47w+</code>字符，行数<code>2235</code>行。<br><strong>更新说明：</strong>(1)原文创建于2019-12-24，更新于2020-05-22，由于时间较久，其中<code>CentOS-7</code>已无<code>1908</code>版；(2)物理机安装环境为<code>Windows 10 1503</code>版，升级为<code>Windows 10 1909</code>版后无法使用<code>VMware Workstation 15 Pro</code>，应升级至<code>15.5+</code>，安装包和注册机网盘链接为<a target="_blank" rel="noopener" href="https://cloud.189.cn/t/j6Bjqmm6VjIf">【天翼云盘，点我下载】</a>；(3)<font color=purple><b>图片足有113张，加载速度较慢，请耐心等待～～</b></font><br><strong>文章作者：</strong><a href="https://hwame.top">鴻塵</a></p>
</blockquote>
<h1 id="1-概述"><a href="#1-概述" class="headerlink" title="1.概述"></a><a name="_Toc513067116"><span style="font-family:黑体; font-size:16pt; font-weight:bold">1.概述</span></a></h1><h2 id="1-1-软件环境"><a href="#1-1-软件环境" class="headerlink" title="1.1.软件环境"></a><a name="_Toc513067117"><span style="font-family:黑体; font-size:14pt; font-weight:bold">1.1.软件环境</span></a></h2><p><span style="font-family:'Times New Roman'; font-size:12pt">1. </span><span style="font-family:宋体; font-size:12pt">软件环境：</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware Workstation 15 Pro</span><span style="font-family:宋体; font-size:12pt">；</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">2. </span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:宋体; font-size:12pt">操作系统（</span><span style="font-family:宋体; font-size:12pt">清华大学开源软件镜像站</span><span style="font-family:'Times New Roman'; font-size:12pt">-CentOS7</span><span style="font-family:宋体; font-size:12pt">下载</span><span style="font-family:宋体; font-size:12pt">），</span><span style="font-family:宋体; font-size:12pt">下载链接</span><span style="font-family:宋体; font-size:12pt">地址：</span><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://mirrors.tuna.tsinghua.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso</span></a></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">中</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">主机名及使用的镜像文件</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">名称</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">系统及文件名</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">master</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">CentOS-7-x86_64-Minimal-1908.iso</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave1</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">CentOS-7-x86_64-Minimal-1908.iso</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave2</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">CentOS-7-x86_64-Minimal-1908.iso</span>
</td></tr></tbody></table></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">3. </span><span style="font-family:宋体; font-size:12pt">网络：我们实验室使用校园网有以下两种方法：</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">1.</span><span style="font-family:宋体; font-size:12pt">连接</span><span style="font-family:'Times New Roman'; font-size:12pt">xxxx_WIRELESS</span><span style="font-family:宋体; font-size:12pt">，然后在弹出的网页中登陆；</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:normal">2.</span><span style="font-family:宋体; font-size:12pt; font-weight:normal">插入网线，然后在弹出的网页中登陆。</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">在这种情况下，如果安装的虚拟机需要联网，必须装桌面版，然后在自带的</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">FireFox</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">中登陆。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image001.png" alt="图片"></p>
<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">登陆</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">网络的两种方式</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:normal">4. </span><span style="font-family:宋体; font-size:12pt; font-weight:normal">虚拟网络采用</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:normal">NAT</span><span style="font-family:宋体; font-size:12pt; font-weight:normal">模式，详见后文。</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">踩过的坑有很多，试过桥接模式，在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Windows</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">物理主机、</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">四</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">台机器之间互</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ping</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，不能保证相互</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ping</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">通。</span></p>
<h1 id="2-安装VMware-Workstation"><a href="#2-安装VMware-Workstation" class="headerlink" title="2.安装VMware Workstation"></a><a name="_Toc29839454"><span style="font-family:黑体; font-size:16pt; font-weight:bold">2.安装</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">VMware Workstation</span></a></h1><p><span style="font-family:宋体; font-size:12pt">安装最新版的</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware Workstation 15 Pro</span><span style="font-family:宋体; font-size:12pt">，注意不能直接双击安装包，而要右键“</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">以管理员方式运行</span><span style="font-family:宋体; font-size:12pt">”（因为安装过程中需要创建相关</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">服务，可能会有权限的问题）。</span></p>
<p><span style="font-family:宋体; font-size:12pt">基本是傻瓜式安装，一路下一步即可。</span></p>
<p><span style="font-family:宋体; font-size:12pt">文件名</span><span style="font-family:宋体; font-size:12pt">：</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware Workstation 15 Pro</span></p>
<p><span style="font-family:宋体; font-size:12pt">网盘链接</span><span style="font-family:宋体; font-size:12pt">：</span><a target="_blank" rel="noopener" href="https://pan.baidu.com/s/1G-Z4r2sLisuYwJbuHsmPPA"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://pan.baidu.com/s/1G-Z4r2sLisuYwJbuHsmPPA</span></a><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">提取码：</span><span style="font-family:'Times New Roman'; font-size:12pt">gf7q</span></p>
<p><span style="font-family:宋体; font-size:12pt">许可证密钥：</span><span style="font-family:'Times New Roman'; font-size:12pt">YG5H2-ANZ0H-M8ERY-TXZZZ-YKRV8</span></p>
<p><span style="font-family:宋体; font-size:12pt"><br>文件名</span><span style="font-family:宋体; font-size:12pt">：</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware-workstation-full-15.5.0-14665864</span></p>
<p><span style="font-family:宋体; font-size:12pt">网盘链接</span><span style="font-family:宋体; font-size:12pt">：</span><a target="_blank" rel="noopener" href="https://pan.baidu.com/s/1ObkjLqzlY5KbAUYMErQN4g"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://pan.baidu.com/s/1ObkjLqzlY5KbAUYMErQN4g</span></a><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">提取码：</span><span style="font-family:'Times New Roman'; font-size:12pt">1314</span></p>
<p><span style="font-family:宋体; font-size:12pt">许可证密钥：</span><span style="font-family:'Times New Roman'; font-size:12pt">GF7TA-2VGD3-08EZZ-15XGG-X7KF2</span><span style="font-family:宋体; font-size:12pt; color:#FF4500">（若错误则需使用注册机</span><span style="font-family:'Times New Roman'; font-size:12pt; color:#FF4500">KeyGen.exe</span><span style="font-family:宋体; font-size:12pt; color:#FF4500">激活，下载地址见顶部《文章说明》）</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">建议：</span><span style="font-family:'Times New Roman'; font-size:12pt">1. </span><span style="font-family:宋体; font-size:12pt">尽量不要安装在</span><span style="font-family:'Times New Roman'; font-size:12pt">C</span><span style="font-family:宋体; font-size:12pt">盘，更改到其他盘符；</span><span style="font-family:'Times New Roman'; font-size:12pt">2. </span><span style="font-family:宋体; font-size:12pt">取消勾选“启动时检查产品更新”和“加入客户体验提升计划”；</span><span style="font-family:'Times New Roman'; font-size:12pt">3. </span><span style="font-family:宋体; font-size:12pt">显示“</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware Workstation Pro</span><span style="font-family:宋体; font-size:12pt">安装向导已完成”时不要点击“完成”，应该点击“许可证”，输入</span><span style="font-family:宋体; font-size:12pt">上面</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">许可证</span><span style="font-family:宋体; font-size:12pt">密钥后再点击“输入”。</span></p>
<h1 id="3-网络配置准备工作"><a href="#3-网络配置准备工作" class="headerlink" title="3.网络配置准备工作"></a><a name="_Toc29839455"><span style="font-family:黑体; font-size:16pt; font-weight:bold">3.网络配置准备工作</span></a></h1><h2 id="3-1-VMware设置"><a href="#3-1-VMware设置" class="headerlink" title="3.1.VMware设置"></a><a name="_Toc29839456"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">3.1.VMware</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">设置</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">中点击“编辑”</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">“虚拟网络编辑器”，点击“更改设置”，如下图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image002.png" alt="图片"></p>
<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">编辑虚拟网络</span></div>

<p><span style="font-family:宋体; font-size:12pt">选择</span><span style="font-family:'Times New Roman'; font-size:12pt">VMnet8</span><span style="font-family:宋体; font-size:12pt">（即</span><span style="font-family:'Times New Roman'; font-size:12pt">NAT</span><span style="font-family:宋体; font-size:12pt">模式），如下图，点击“</span><span style="font-family:'Times New Roman'; font-size:12pt">NAT</span><span style="font-family:宋体; font-size:12pt">设置”出现右图。其中，子网</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">和子网掩码默认即可，网关</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">将最后一位随意修改一下（与</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">不同）。</span><span style="font-family:宋体; font-size:12pt">记住</span><span style="font-family:宋体; font-size:12pt">下图中的</span><span style="font-family:宋体; font-size:12pt">三个值：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image003.png" alt="图片"></p>
<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">NAT</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">模式</span></div>

<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">中主机名及使用的镜像文件</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">名称</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IP</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">地址</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">备注</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt">子网</span><span style="font-family:'Times New Roman'; font-size:10.5pt">IP</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">192.168.176.0</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">默认值</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt">子网掩码</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">255.255.255.0</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">默认值</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt">网关</span><span style="font-family:'Times New Roman'; font-size:10.5pt">IP</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">192.168.176.x</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">修改</span><span style="font-family:'Times New Roman'; font-size:10.5pt">x</span><span style="font-family:宋体; font-size:10.5pt">，此处</span><span style="font-family:宋体; font-size:10.5pt">的值为</span><span style="font-family:'Times New Roman'; font-size:10.5pt">x=2</span>
</td></tr></tbody></table></div>

<h2 id="3-2-控制面板网络设置"><a href="#3-2-控制面板网络设置" class="headerlink" title=" 3.2.控制面板网络设置"></a><a name="_Toc29839457"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold"> </span><span style="font-family:黑体; font-size:14pt; font-weight:bold">3.2.控制面板网络设置</span></a></h2><h3 id="3-2-1-查看网卡"><a href="#3-2-1-查看网卡" class="headerlink" title="3.2.1.查看网卡"></a><a name="_Toc29839458"><span style="font-family:黑体; font-size:12pt; font-weight:bold">3.2.1.查看网卡</span></a></h3><p><span style="font-family:宋体; font-size:12pt">打开控制面板</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">网络和共享中心</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">更改适配器设置，如下图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image004.png" alt="图片"></p>
<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">控制面板网络</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">连接</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">情况</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">之前安装的</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">版本为</span><span style="font-family:'Times New Roman'; font-size:12pt">VM10</span><span style="font-family:宋体; font-size:12pt">，出现的不是“已启用”而是“未识别的网络”，通过安装最新版本</span><span style="font-family:'Times New Roman'; font-size:12pt">VM15</span><span style="font-family:宋体; font-size:12pt">解决；</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">可以发现，上图中没有</span><span style="font-family:'Times New Roman'; font-size:12pt">VMnet0</span><span style="font-family:宋体; font-size:12pt">（桥接模式），这个问题应该是打开</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">时没有选择以管理员方式运行。</span></p>
<h3 id="3-2-2-配置虚拟网卡VMnet8"><a href="#3-2-2-配置虚拟网卡VMnet8" class="headerlink" title="3.2.2.配置虚拟网卡VMnet8"></a><a name="_Toc29839459"><span style="font-family:黑体; font-size:12pt; font-weight:bold">3.2.2.配置虚拟网卡</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">VMnet8</span></a></h3><p><span style="font-family:宋体; font-size:12pt">双击</span><span style="font-family:'Times New Roman'; font-size:12pt">VMnet8</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:'Times New Roman'; font-size:12pt">NAT</span><span style="font-family:宋体; font-size:12pt">模式），点击“属性”，先选中“</span><span style="font-family:'Times New Roman'; font-size:12pt">Internet</span><span style="font-family:宋体; font-size:12pt">协议版本</span><span style="font-family:'Times New Roman'; font-size:12pt">4(TCP/IPv4</span><span style="font-family:宋体; font-size:12pt">”然后点击“属性”，选择“使用下面的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址”和“使用下面的</span><span style="font-family:'Times New Roman'; font-size:12pt">DNS</span><span style="font-family:宋体; font-size:12pt">服务器地址”，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image005.png" alt="图片"></p>
<div style="text-align:center">
<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置虚拟网卡</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IP</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">段</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">其中子网掩码和默认网关的地址和</span><span style="font-family:'Times New Roman'; font-size:12pt">2.1</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">VMware</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">设置</span><span style="font-family:宋体; font-size:12pt">中一致，</span><span style="font-family:宋体; font-size:12pt">但</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址不和子网</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">相同，比如我在这里设置为</span><span style="font-family:'Times New Roman'; font-size:12pt">20</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<h2 id="3-3-查看物理主机信息"><a href="#3-3-查看物理主机信息" class="headerlink" title="3.3.查看物理主机信息"></a><a name="_Toc29839460"><span style="font-family:黑体; font-size:14pt; font-weight:bold">3.3.查看物理主机信息</span></a></h2><p><span style="font-family:宋体; font-size:12pt">按“</span><span style="font-family:'Times New Roman'; font-size:12pt">Windows</span><span style="font-family:宋体; font-size:12pt">键＋</span><span style="font-family:'Times New Roman'; font-size:12pt">R</span><span style="font-family:宋体; font-size:12pt">”输入“</span><span style="font-family:'Times New Roman'; font-size:12pt">cmd</span><span style="font-family:宋体; font-size:12pt">”打开命令行，输入</span><span style="border-color:#000000; border-style:solid; border-width:0.75pt; color:#ff0000; font-family:Consolas; font-size:12pt">ipconfig /all</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">查看物理主机的</span><span style="font-family:'Times New Roman'; font-size:12pt">Windows IP</span><span style="font-family:宋体; font-size:12pt">设置，</span><span style="font-family:宋体; font-size:12pt">如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image006.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">查看</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Windows</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">物理主机</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IP</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">可以看到，物理主机信息和</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">默认的值很不一样。</span><span style="font-family:宋体; font-size:12pt">这是因为</span><span style="font-family:'Times New Roman'; font-size:12pt">Windows</span><span style="font-family:宋体; font-size:12pt">物理机</span><span style="font-family:宋体; font-size:12pt">本身是处于校园网中，获得的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址也是自动分配的，如果使用</span><span style="font-family:'Times New Roman'; font-size:12pt">WiFi</span><span style="font-family:宋体; font-size:12pt">连接登陆则</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">又不一样。此处的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">是插入网线获得的，保证</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">不变。</span></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Windows</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">物理主机</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IP</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Windows</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">物理主机</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IP</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">地址</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">备注</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">IPv4</span><span style="font-family:宋体; font-size:10.5pt">地址</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">222.20.82.252</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">不同于</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMware</span><span style="font-family:宋体; font-size:10.5pt">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMnet</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt">子网掩码</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">255.255.252.0</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">不同于</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMware</span><span style="font-family:宋体; font-size:10.5pt">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMnet</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:宋体; font-size:10.5pt">默认网关</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">222.20.83.254</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">不同于</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMware</span><span style="font-family:宋体; font-size:10.5pt">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt">VMnet</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">DNS</span><span style="font-family:宋体; font-size:10.5pt">服务器</span><span style="font-family:'Times New Roman'; font-size:10.5pt">1</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">202.114.0.131</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">默认值</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:100.7pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">DNS</span><span style="font-family:宋体; font-size:10.5pt">服务器</span><span style="font-family:'Times New Roman'; font-size:10.5pt">2</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:123.85pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">202.114.0.242</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:194.75pt">

<span style="font-family:宋体; font-size:10.5pt">默认值</span>
</td></tr></tbody></table></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="4-安装虚拟机"><a href="#4-安装虚拟机" class="headerlink" title="4.安装虚拟机"></a><a name="_Toc29839461"><span style="font-family:黑体; font-size:16pt; font-weight:bold">4.安装虚拟机</span></a></h1><h2 id="4-1-安装Master"><a href="#4-1-安装Master" class="headerlink" title="4.1.安装Master"></a><a name="_Toc29839462"><span style="font-family:黑体; font-size:14pt; font-weight:bold">4.1.安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Master</span></a></h2><h3 id="4-1-1-说明"><a href="#4-1-1-说明" class="headerlink" title="4.1.1.说明"></a><a name="_Toc29839463"><span style="font-family:黑体; font-size:12pt; font-weight:bold">4.1.1.说明</span></a></h3><p><span style="font-family:'Times New Roman'; font-size:12pt">1. </span><span style="font-family:宋体; font-size:12pt">必须</span><span style="font-family:宋体; font-size:12pt">在网络配置完成后</span><span style="font-family:宋体; font-size:12pt">才可进行接下来的步骤。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">2. </span><span style="font-family:宋体; font-size:12pt">为保证以下顺利进行，需要保证</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">服务已全部开启（</span><span style="font-family:'Times New Roman'; font-size:12pt">VM15</span><span style="font-family:宋体; font-size:12pt">应该无需考虑），查看是否启动步骤：此电脑右键</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">管理</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">双击服务和应用程序</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">双击服务，确保</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">相关服务的状态为“正在运行”（至少保证①</span><span style="font-family:'Times New Roman'; font-size:12pt">Authorization Service</span><span style="font-family:宋体; font-size:12pt">、②</span><span style="font-family:'Times New Roman'; font-size:12pt">NAT Service</span><span style="font-family:宋体; font-size:12pt">、③</span><span style="font-family:'Times New Roman'; font-size:12pt">Workstation Server</span><span style="font-family:宋体; font-size:12pt">三者正在运行），如下图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image007.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">VMware</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">相关的服务</span></div>

<h3 id="4-1-2-新建虚拟机"><a href="#4-1-2-新建虚拟机" class="headerlink" title="4.1.2.新建虚拟机"></a><a name="_Toc29839464"><span style="font-family:黑体; font-size:12pt; font-weight:bold">4.1.2.新建虚拟机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">打开“新建虚拟机向导”</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">选择自定义，下一步</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">硬件兼容性默认，下一步</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">选择“稍后安装操作系统”，下一步</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">操作系统选择</span><span style="font-family:'Times New Roman'; font-size:12pt">Linux</span><span style="font-family:宋体; font-size:12pt">，版本选择</span><span style="font-family:'Times New Roman'; font-size:12pt">CentOS 7 64</span><span style="font-family:宋体; font-size:12pt">位，下一步</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">修改虚拟机名称【默认位置可在“编辑”</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">“首选项”修改，默认</span><span style="font-family:'Times New Roman'; font-size:12pt">C</span><span style="font-family:宋体; font-size:12pt">盘，也可手动指定，但必须先修改位置然后命名虚拟机名称】，如下图</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image008.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">新建虚拟机向导</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">处理器配置默认即可</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">虚拟机内存选择</span><span style="font-family:'Times New Roman'; font-size:12pt">2048MB</span><span style="font-family:宋体; font-size:12pt">（如果自己电脑内存小于</span><span style="font-family:'Times New Roman'; font-size:12pt">8G</span><span style="font-family:宋体; font-size:12pt">，建议默认</span><span style="font-family:'Times New Roman'; font-size:12pt">1024MB</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">网络类型选择“网络地址转换</span><span style="font-family:'Times New Roman'; font-size:12pt">NAT</span><span style="font-family:宋体; font-size:12pt">”，下一步</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">I/O</span><span style="font-family:宋体; font-size:12pt">控制器类型和磁盘类型默认</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">选择“创建新虚拟磁盘”</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">磁盘大小默认</span><span style="font-family:'Times New Roman'; font-size:12pt">20.0GB</span><span style="font-family:宋体; font-size:12pt">，选择“拆分成多个文件”</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:宋体; font-size:12pt">由于</span><span style="font-family:宋体; font-size:12pt">拆分成多个文件</span><span style="font-family:宋体; font-size:12pt">，因此</span><span style="font-family:宋体; font-size:12pt">实际不会使用</span><span style="font-family:宋体; font-size:12pt">到</span><span style="font-family:'Times New Roman'; font-size:12pt">20.0GB</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">指定磁盘文件默认</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">→</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">点击“自定义硬件”弹出硬件窗口，</span><span style="font-family:宋体; font-size:12pt">在“硬件”窗口中</span><span style="font-family:宋体; font-size:12pt">点击“新</span><span style="font-family:'Times New Roman'; font-size:12pt">CD/DVD</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:'Times New Roman'; font-size:12pt">IDE</span><span style="font-family:宋体; font-size:12pt">）”选中使用</span><span style="font-family:'Times New Roman'; font-size:12pt">ISO</span><span style="font-family:宋体; font-size:12pt">映像文件并选择下载好的</span><span style="font-family:'Times New Roman'; font-size:12pt">CentOS-7-x86_64-Minimal-1908.iso</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">（如图</span><span style="font-family:'Times New Roman'; font-size:12pt">4.3</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">然后</span><span style="font-family:宋体; font-size:12pt">点击关闭，最后点击完成。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image009.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">选择</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">ISO</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">映像文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="4-1-3-安装虚拟机"><a href="#4-1-3-安装虚拟机" class="headerlink" title="4.1.3.安装虚拟机"></a><a name="_Toc29839465"><span style="font-family:黑体; font-size:12pt; font-weight:bold">4.1.3.安装虚拟机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">说明：因为我的集群已经搭建完成，下文以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image010.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机新建完成</span></div>

<p><span style="font-family:宋体; font-size:12pt">选中新建的虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">，点击“开启此虚拟机”，如上图。进入安装界面，输入“</span><span style="font-family:'Times New Roman'; font-size:12pt">chi</span><span style="font-family:宋体; font-size:12pt">”以筛选，然后选择中文，如下图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image011.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机安装界面选择语言</span></div>

<p><span style="font-family:宋体; font-size:12pt">点击“安装位置”，无需更改，直接点击“完成”，然后点击“网络和主机名”，如下图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image012.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装信息摘要</span></div>

<p><span style="font-family:宋体; font-size:12pt">在弹出的“网络和主机名”中</span><span style="font-family:宋体; font-size:12pt">将主机名改为“</span><span style="font-family:'Times New Roman'; font-size:12pt">master</span><span style="font-family:宋体; font-size:12pt">（此处以</span><span style="font-family:'Times New Roman'; font-size:12pt">tester</span><span style="font-family:宋体; font-size:12pt">为例）</span><span style="font-family:宋体; font-size:12pt">”后点击“应用”，右边“当前主机名”会变为</span><span style="font-family:'Times New Roman'; font-size:12pt">master</span><span style="font-family:宋体; font-size:12pt">（此处以</span><span style="font-family:'Times New Roman'; font-size:12pt">tester</span><span style="font-family:宋体; font-size:12pt">为例），如图。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image013.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">修改主机名（</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">以</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">为例</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<h3 id="4-1-4-配置Master网络"><a href="#4-1-4-配置Master网络" class="headerlink" title="4.1.4.配置Master网络"></a><a name="_Toc29839466"><span style="font-family:黑体; font-size:12pt; font-weight:bold">4.1.4.配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">网络</span></a></h3><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">修改主机名后</span><span style="font-family:宋体; font-size:12pt">，点击“配置”。在“以太网”选项卡中，将</span><span style="font-family:宋体; font-size:12pt">“设备”</span><span style="font-family:宋体; font-size:12pt">改为带有</span><span style="font-family:'Times New Roman'; font-size:12pt">MAC</span><span style="font-family:宋体; font-size:12pt">地址的</span><span style="font-family:'Times New Roman'; font-size:12pt">ens33</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:'Times New Roman'; font-size:12pt">00:0C:29:</span><span style="font-family:'Times New Roman'; font-size:12pt">03</span><span style="font-family:'Times New Roman'; font-size:12pt">:</span><span style="font-family:'Times New Roman'; font-size:12pt">C5</span><span style="font-family:'Times New Roman'; font-size:12pt">:</span><span style="font-family:'Times New Roman'; font-size:12pt">51</span><span style="font-family:宋体; font-size:12pt">），如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image014.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置之</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">“以太网”选项卡（</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">以</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">为例</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">在“</span><span style="font-family:'Times New Roman'; font-size:12pt">IPv4</span><span style="font-family:宋体; font-size:12pt">设置”选项卡中，</span><span style="font-family:宋体; font-size:12pt">首先</span><span style="font-family:宋体; font-size:12pt">将方法</span><span style="font-family:宋体; font-size:12pt">修改</span><span style="font-family:宋体; font-size:12pt">为“手动”，</span><span style="font-family:宋体; font-size:12pt">然后</span><span style="font-family:宋体; font-size:12pt">点击“</span><span style="font-family:'Times New Roman'; font-size:12pt">Add</span><span style="font-family:宋体; font-size:12pt">”添加地址和</span><span style="font-family:'Times New Roman'; font-size:12pt">DNS</span><span style="font-family:宋体; font-size:12pt">服务器</span><span style="font-family:宋体; font-size:12pt">。其中，</span><span style="font-family:'Times New Roman'; font-size:12pt">master</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址设置为</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">192.168.172.200</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">tester</span><span style="font-family:宋体; font-size:12pt">为例</span><span style="font-family:宋体; font-size:12pt">，此处设置的是</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">192.168.176.</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">203</span><span style="font-family:宋体; font-size:12pt">）；子网掩码</span><span style="font-family:宋体; font-size:12pt">各节点</span><span style="font-family:宋体; font-size:12pt">相同</span><span style="font-family:宋体; font-size:12pt">（与</span><span style="font-family:'Times New Roman'; font-size:12pt">VMware</span><span style="font-family:宋体; font-size:12pt">虚拟网络中的子网掩码一致）</span><span style="font-family:宋体; font-size:12pt">，都是</span><span style="font-family:'Times New Roman'; font-size:12pt">255.255.255.0</span><span style="font-family:宋体; font-size:12pt">，也可写为</span><span style="font-family:'Times New Roman'; font-size:12pt">24</span><span style="font-family:宋体; font-size:12pt">，两种写法是等价的；</span><span style="font-family:'Times New Roman'; font-size:12pt">DNS</span><span style="font-family:宋体; font-size:12pt">服务器地址有两个</span><span style="font-family:'Times New Roman'; font-size:12pt">202.114.0.131</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">202.114.0.242</span><span style="font-family:宋体; font-size:12pt">，以英文逗号分隔</span><span style="font-family:宋体; font-size:12pt">，且无多余空格</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">配置如下图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image015.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置之</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">“</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">IPv4</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置”选项卡（</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">以</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">为例</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">3</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">在“</span><span style="font-family:'Times New Roman'; font-size:12pt">IPv</span><span style="font-family:'Times New Roman'; font-size:12pt">6</span><span style="font-family:宋体; font-size:12pt">设置”选项卡中，将方法改为“</span><span style="font-family:宋体; font-size:12pt">忽略”以禁用，配置完成点击“保存”。然后打开网络连接，可以看到配置生效，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image016.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">打开以太网连接配置</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">生效（</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">以</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">为例</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">4</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">最后在“网络和主机名”页面点击完成，可以看到所有安装信息均已完成，如图所示，最后点击“开始安装”。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image017.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息摘要全部完成配置</span></div>

<h3 id="4-1-5-设置root密码"><a href="#4-1-5-设置root密码" class="headerlink" title="4.1.5.设置root密码"></a><a name="_Toc29839467"><span style="font-family:黑体; font-size:12pt; font-weight:bold">4.1.5.设置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">root</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">密码</span></a></h3><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">由上开始安装后，界面如下图所示，此时必须设置</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">密码以完成带有警告图标的内容（只需要设置</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">密码，两处的标记即可正常）。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image018.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">CentOS7</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">正在安装但尚未设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密码</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">点击设置</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">密码，如果密码强度太弱，则需要点击两次“完成”，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image019.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密码</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">3</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">完成</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">密码的设置，即使没有参加用户也不会有标记，点击“完成配置”，如图所示。</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">在大数据集群搭建过程中，我们需要两个用户</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，目前只需要</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">管理员即可。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image020.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">14</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密码</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">4</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt">点击“完成配置”后</span><span style="font-family:宋体; font-size:12pt">继续</span><span style="font-family:宋体; font-size:12pt">等待其他</span><span style="font-family:宋体; font-size:12pt">必要</span><span style="font-family:宋体; font-size:12pt">配置完成，最后点击重启，从而启动虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">master</span><span style="font-family:宋体; font-size:12pt">（此处为</span><span style="font-family:'Times New Roman'; font-size:12pt">tester</span><span style="font-family:宋体; font-size:12pt">），如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image021.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">15</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">CentOS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">（此处为</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<h2 id="4-2-安装Slave1"><a href="#4-2-安装Slave1" class="headerlink" title="4.2.安装Slave1"></a><a name="_Toc29839468"><span style="font-family:黑体; font-size:14pt; font-weight:bold">4.2.安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Slave1</span></a></h2><p><span style="font-family:宋体; font-size:12pt">同</span><span style="font-family:'Times New Roman'; font-size:12pt">4.1</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">，将虚拟机名称</span><span style="font-family:宋体; font-size:12pt">设置</span><span style="font-family:宋体; font-size:12pt">为“</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">”，同时将</span><span style="font-family:宋体; font-size:12pt">主机名</span><span style="font-family:宋体; font-size:12pt">修改</span><span style="font-family:宋体; font-size:12pt">为“</span><span style="font-family:'Times New Roman'; font-size:12pt">slave1</span><span style="font-family:宋体; font-size:12pt">”</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">且网络</span><span style="font-family:宋体; font-size:12pt">配置中</span><span style="font-family:'Times New Roman'; font-size:12pt">slave1</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址设置为</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">192.168.172.20</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<h2 id="4-3-安装Slave2"><a href="#4-3-安装Slave2" class="headerlink" title=" 4.3.安装Slave2"></a><a name="_Toc29839469"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold"> </span><span style="font-family:黑体; font-size:14pt; font-weight:bold">4.3.安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Slave2</span></a></h2><p><span style="font-family:宋体; font-size:12pt">同</span><span style="font-family:'Times New Roman'; font-size:12pt">4.1</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">，将虚拟机名称</span><span style="font-family:宋体; font-size:12pt">设置</span><span style="font-family:宋体; font-size:12pt">为“</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">”，同时将</span><span style="font-family:宋体; font-size:12pt">主机名</span><span style="font-family:宋体; font-size:12pt">修改</span><span style="font-family:宋体; font-size:12pt">为“</span><span style="font-family:'Times New Roman'; font-size:12pt">slave2</span><span style="font-family:宋体; font-size:12pt">”</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">且网络</span><span style="font-family:宋体; font-size:12pt">配置中</span><span style="font-family:'Times New Roman'; font-size:12pt">slave2</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">地址设置为</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">192.168.172.20</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">至此，一主二次的虚拟机安装完成，如图所示（未删除测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">）。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image022.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">16</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">一主二次</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">＋</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">＋</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="5-虚拟机配置"><a href="#5-虚拟机配置" class="headerlink" title=" 5.虚拟机配置"></a><a name="_Toc29839470"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold"> </span><span style="font-family:黑体; font-size:16pt; font-weight:bold">5.虚拟机配置</span></a></h1><h2 id="5-1-设置各节点名称"><a href="#5-1-设置各节点名称" class="headerlink" title="5.1.设置各节点名称"></a><a name="_Toc29839471"><span style="font-family:黑体; font-size:14pt; font-weight:bold">5.1.设置各节点名称</span></a></h2><p><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例，</span><span style="font-family:宋体; font-size:12pt">输入</span><span style="font-family:宋体; font-size:12pt">并回车</span><span style="font-family:宋体; font-size:12pt">，按“</span><span style="font-family:'Times New Roman'; font-size:12pt">I</span><span style="font-family:宋体; font-size:12pt">”键进入编辑模式。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span>
<span style="font-family:Consolas; font-size:12pt">tester</span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]</span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt">#</span>
<span style="width:17.44pt; text-indent:0pt; display:inline-block"></span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/sysconfig/network</span>
</div>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>


<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">旧</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Created</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> by anaconda</span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">新</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Created</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> by anaconda<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp&nbsp&nbsp&nbspNETWORKING=yes<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp&nbsp&nbsp&nbspHOSTNAME=</span><span style="font-family:Consolas; font-size:12pt">master<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp&nbsp&nbsp&nbspGATEWAY=192.168.176.2</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">编辑完成后，按“</span><span style="font-family:'Times New Roman'; font-size:12pt">Esc</span><span style="font-family:宋体; font-size:12pt">”键退出编辑模式，然后按“</span><span style="font-family:'Times New Roman'; font-size:12pt">Shift</span><span style="font-family:宋体; font-size:12pt">＋：”，最后输入“</span><span style="font-family:'Times New Roman'; font-size:12pt">wq</span><span style="font-family:宋体; font-size:12pt">”（必须小写）</span><span style="font-family:宋体; font-size:12pt">并回车</span><span style="font-family:宋体; font-size:12pt">保存退出。</span></p>
<div>
<span style="font-family:宋体; font-size:12pt; font-weight:bold">注</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="width:15pt; text-indent:0pt; display:inline-block"></span><span style="font-family:宋体; font-size:12pt; font-weight:bold">①</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">内容</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">编辑过，需要保存并退出，则输入“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">wq</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”；<br></span>

<span style="width:18pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="font-family:宋体; font-size:12pt; font-weight:bold">②</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">内容编辑过，不保存强制退出，则输入“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">q!</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”；<br></span>

<span style="width:18pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="font-family:宋体; font-size:12pt; font-weight:bold">③内容未编辑过，直接退出，则输入“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">q</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”。<br></span>
</div>

<p><span style="font-family:宋体; font-size:12pt">设置完成后各节点</span><span style="font-family:宋体; font-size:12pt">名称</span><span style="font-family:宋体; font-size:12pt">如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image023.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点名称</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image024.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点名称</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image025.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点名称</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h2 id="5-2-配置hosts"><a href="#5-2-配置hosts" class="headerlink" title="5.2.配置hosts"></a><a name="_Toc29839472"><span style="font-family:黑体; font-size:14pt; font-weight:bold">5.2.配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">hosts</span></a></h2><p><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例，</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">hosts</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/hosts</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">修改前原</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hosts</span><span style="font-family:宋体; font-size:12pt">文件内容为</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">127.0.0.1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="width:18.02pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdomain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdom</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">4</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">:</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:1</span><span style="width:1.21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;localhost</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdomain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdom</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">4</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">修改</span><span style="font-family:宋体; font-size:12pt">后</span><span style="font-family:宋体; font-size:12pt">的</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hosts</span><span style="font-family:宋体; font-size:12pt">文件内容为</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">127.0.0.1</span><span style="width:3.62pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdomain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdom</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">4</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">:</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:1</span><span style="width:1.21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;localhost</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdomain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost4.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localdom</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ain</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">4</span>

<span style="font-family:Consolas; font-size:12pt">192.168.176.20</span><span style="font-family:Consolas; font-size:12pt">3</span><span style="width:6.04pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="font-family:Consolas; font-size:12pt">tester</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">192.168.176.201</span><span style="width:6.04pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave1</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">192.168.176.202</span><span style="width:6.04pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">保存之后</span><span style="font-family:宋体; font-size:12pt">，在</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">将该文件分别拷贝</span><span style="font-family:宋体; font-size:12pt">至另外</span><span style="font-family:宋体; font-size:12pt">两个子节点</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">5.4</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/hosts </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">root@192.168.176.201:/etc/<br></span>
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/hosts root@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">192.168.176.202</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/etc/</span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image026.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">远程拷贝</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hosts</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">设置完成后各节点</span><span style="font-family:'Times New Roman'; font-size:12pt">hosts</span><span style="font-family:宋体; font-size:12pt">文件都是一样的，</span><span style="font-family:宋体; font-size:12pt">如下图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image027.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">各主机的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hosts</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置（</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">相同</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">）</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="5-3-配置各节点网卡"><a href="#5-3-配置各节点网卡" class="headerlink" title="5.3.配置各节点网卡"></a><a name="_Toc29839473"><span style="font-family:黑体; font-size:14pt; font-weight:bold">5.3.配置各节点网卡</span></a></h2><p><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例，配置网卡</span><span style="font-family:'Times New Roman'; font-size:12pt">ens33</span><span style="font-family:宋体; font-size:12pt">。由于在安装虚拟机的过程中已经基本配置好网络，因此只需要修改为静态</span><span style="font-family:'Times New Roman'; font-size:12pt">IP</span><span style="font-family:宋体; font-size:12pt">即可</span><span style="font-family:宋体; font-size:12pt">（理论上，这一步也不需要，默认值是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">BOOTPROTO=</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">none</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">查看原始网卡信息</span><span style="font-family:宋体; font-size:12pt">如图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cat</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/sysconfig</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/network-scripts/ifcfg-ens33</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image028.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">网卡</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">ens33</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">vi</span><span style="font-family:宋体; font-size:12pt">编辑此</span><span style="font-family:宋体; font-size:12pt">文件，将</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">BOOTPROTO=</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">none</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="font-family:宋体; font-size:12pt">修改为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">BOOTPROTO=</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">static</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">”</span><span style="font-family:宋体; font-size:12pt">，保存后重启网络：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> restart network</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h2 id="5-4-关闭防火墙"><a href="#5-4-关闭防火墙" class="headerlink" title=" 5.4.关闭防火墙"></a><a name="_Toc29839474"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold"> </span><span style="font-family:黑体; font-size:14pt; font-weight:bold">5.4.关闭防火墙</span></a></h2><h3 id="5-4-1-以Tester为例"><a href="#5-4-1-以Tester为例" class="headerlink" title="5.4.1.以Tester为例"></a><a name="_Toc29839475"><span style="font-family:黑体; font-size:12pt; font-weight:bold">5.4.1.以</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Tester</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">为例</span></a></h3><p><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例，首先查看防火墙状态</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:'Times New Roman'; font-size:12pt">status</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">，如图所示（默认状态为开启）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">sys</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">temctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> status firewalld</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image029.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">查看防火墙状态</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">我们需要禁用（永久关闭）防火墙，操作</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">operation</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">为“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">disable</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”；如果是临时关闭，则操作</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">operation</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">为“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">stop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”；开启防火墙的操作</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">operation</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">为“</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">start</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">禁用后需要重</span><span style="font-family:宋体; font-size:12pt">启网络</span><span style="font-family:宋体; font-size:12pt">并重启虚拟机</span><span style="font-family:宋体; font-size:12pt">（或者关闭</span><span style="font-family:'Times New Roman'; font-size:12pt">&lt;stop&gt;</span><span style="font-family:宋体; font-size:12pt">防火墙</span><span style="font-family:宋体; font-size:12pt">即可，</span><span style="font-family:宋体; font-size:12pt">而不需要重启虚拟机）</span><span style="font-family:宋体; font-size:12pt">使之生效，再次查看状态，可以发现已经禁用，如图所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> di</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">able firewalld</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">restart network</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">reboot</span><span style="font-family:宋体; font-size:12pt">（或者）</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl stop firewalld</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> status firewalld</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image030.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">reboot</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">重启后再次</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">查看防火墙状态</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">该步骤</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">分别在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上进行，禁用所有节点的防火墙。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h3 id="5-4-2-Master关闭防火墙截图"><a href="#5-4-2-Master关闭防火墙截图" class="headerlink" title="5.4.2.Master关闭防火墙截图"></a><a name="_Toc29839476"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">5.4.2.Master</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">关闭防火墙截图</span></a></h3><p><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例，首先查看防火墙状态（</span><span style="font-family:'Times New Roman'; font-size:12pt">status</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">active</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">（</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">running</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">（因为防火墙默认是开启的），然后禁用防火墙服务，此时防火墙依然是运行状态（因为在防火墙已经是开启的状态下禁用服务，只能影响下一次，所以需要重启生效或者手动关闭防火墙）。关闭（</span><span style="font-family:'Times New Roman'; font-size:12pt">stop</span><span style="font-family:宋体; font-size:12pt">）防火墙后再次查看防火墙状态，可以看到其状态为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">inactive</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">（</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">dead</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">。</span><span style="font-family:宋体; font-size:12pt">如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image031.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold"> Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">关闭防火墙</span></div>

<h2 id="5-5-互ping测试"><a href="#5-5-互ping测试" class="headerlink" title="5.5.互ping测试"></a><a name="_Toc29839477"><span style="font-family:黑体; font-size:14pt; font-weight:bold">5.5.互</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">ping</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">测试</span></a></h2><h3 id="5-5-1-Windows物理主机"><a href="#5-5-1-Windows物理主机" class="headerlink" title="5.5.1.Windows物理主机"></a><a name="_Toc29839478"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">5.5.1.Windows</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">物理主机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">打开</span><span style="font-family:'Times New Roman'; font-size:12pt">cmd</span><span style="font-family:宋体; font-size:12pt">窗口，分别</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">四台虚拟机（包括</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">），如图所示：</span></p>
<p><span style="font-family:宋体; font-size:12pt">物理主机</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">C:\Users\</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">鴻塵</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="width:12.02pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ping 192.168.176.200</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">物理主机</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">C:\Users\</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">鴻塵</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="width:12.02pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ping 192.168.176.201</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">物理主机</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">C:\Users\</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">鴻塵</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="width:12.02pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ping 192.168.176.202</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">物理主机</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">C:\Users\</span><span style="color:#ff0000; font-family:宋体; font-size:12pt">鴻塵</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="width:12.02pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ping 192.168.176.203</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image032.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Windows</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">物理主机</span></div>

<h3 id="5-5-2-Mater虚拟机"><a href="#5-5-2-Mater虚拟机" class="headerlink" title="5.5.2.Mater虚拟机"></a><a name="_Toc29839479"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">5.5.2.Mater</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">虚拟机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Mater</span><span style="font-family:宋体; font-size:12pt">分别</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">物理主机、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">和测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">（此处未截图，实际能</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">通），以及外网（百度）</span><span style="font-family:宋体; font-size:12pt">，如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image033.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Mater</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="5-5-3-Slave1虚拟机"><a href="#5-5-3-Slave1虚拟机" class="headerlink" title="5.5.3.Slave1虚拟机"></a><a name="_Toc29839480"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">5.5.3.Slave1</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">虚拟机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">分别</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">物理主机、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Mater</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">和测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">（此处未截图，实际能</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">通），以及外网（百度），如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image034.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="5-5-4-Slave2虚拟机"><a href="#5-5-4-Slave2虚拟机" class="headerlink" title="5.5.4.Slave2虚拟机"></a><a name="_Toc29839481"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">5.5.4.Slave2</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">虚拟机</span></a></h3><p><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">分别</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">物理主机、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Mater</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:宋体; font-size:12pt">虚拟机</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">（此处未截图，实际能</span><span style="font-family:'Times New Roman'; font-size:12pt">ping</span><span style="font-family:宋体; font-size:12pt">通），以及外网（百度），如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image035.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">虚拟机</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">由上，集群内三台虚拟机可以相互通信，也可以和</span><span style="font-family:'Times New Roman'; font-size:12pt">Windows</span><span style="font-family:宋体; font-size:12pt">物理主机相互通信，并且可访问外网。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">&#xa0;</span></p>
<h1 id="6-JDK的安装与配置"><a href="#6-JDK的安装与配置" class="headerlink" title="6.JDK的安装与配置"></a><a name="_Toc29839482"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">6.</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">JDK</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">的安装与配置</span></a></h1><p><span style="font-family:宋体; font-size:12pt">由于</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">的编译及</span><span style="font-family:'Times New Roman'; font-size:12pt">MapReduce</span><span style="font-family:宋体; font-size:12pt">的运行都需要使用</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">，所以需要在</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群中的每一台机器</span><span style="font-family:宋体; font-size:12pt">上提前安装</span><span style="font-family:宋体; font-size:12pt">好能够</span><span style="font-family:宋体; font-size:12pt">满足</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">最低版本要求的</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">参考文章：</span><a target="_blank" rel="noopener" href="https://blog.csdn.net/github_38336924/article/details/82221258"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://blog.csdn.net/github_38336924/article/details/82221258</span></a></p>
<h2 id="6-1-检查是否已安装JDK及卸载"><a href="#6-1-检查是否已安装JDK及卸载" class="headerlink" title="6.1.检查是否已安装JDK及卸载"></a><a name="_Toc29839483"><span style="font-family:黑体; font-size:14pt; font-weight:bold">6.1.检查是否已安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">JDK</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">及卸载</span></a></h2><p><span style="font-family:宋体; font-size:12pt">测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">未安装过</span><span style="font-family:'Times New Roman'; font-size:12pt">Java</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">故</span><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">检查是否已安装</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">（中括号选其一）</span><span style="font-family:宋体; font-size:12pt">，如下图（图中没有输出信息即代表没有相关的安装文件）</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yum</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> list installed | grep </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">][jdk]</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">查询已安装的包文件</span><span style="font-family:宋体; font-size:12pt">（中括号选其一），如下图（图中没有输出信息即代表没有相关的安装文件）</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">rpm</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -qa | grep [java][jdk][gcj]</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image036.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">检查是否已安装</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">没有</span><span style="font-family:'Times New Roman'; font-size:12pt">Java</span><span style="font-family:宋体; font-size:12pt">相关的文件，因此不需要卸载。</span><span style="font-family:宋体; font-size:12pt">安装</span><span style="font-family:宋体; font-size:12pt">过程</span><span style="font-family:宋体; font-size:12pt">省略。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h2 id="6-2-Master安装JDK"><a href="#6-2-Master安装JDK" class="headerlink" title="6.2.Master安装JDK"></a><a name="_Toc29839484"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">6.2.Master</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">JDK</span></a></h2><h3 id="6-2-1-查看JDK软件包列表"><a href="#6-2-1-查看JDK软件包列表" class="headerlink" title="6.2.1.查看JDK软件包列表"></a><a name="_Toc29839485"><span style="font-family:黑体; font-size:12pt; font-weight:bold">6.2.1.查看</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">JDK</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">软件包列表</span></a></h3><p><span style="font-family:宋体; font-size:12pt">查看</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">软件包列表</span><span style="font-family:宋体; font-size:12pt">，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yum</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">search java-1.8.0</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> | grep </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–i</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">  --color jdk</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image037.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">查看</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">软件包列表</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="6-2-2安装openjdk"><a href="#6-2-2安装openjdk" class="headerlink" title="6.2.2安装openjdk"></a><a name="_Toc29839486"><span style="font-family:黑体; font-size:12pt; font-weight:bold">6.2.2安装</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">openjdk</span></a></h3><p><span style="font-family:宋体; font-size:12pt">在上图</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">软件包列表</span><span style="font-family:宋体; font-size:12pt">中，不需要安装所有包，只需要</span><span style="font-family:宋体; font-size:12pt">安装</span><span style="font-family:宋体; font-size:12pt">其中</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk</span><span style="font-family:宋体; font-size:12pt">和</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk-devel</span><span style="font-family:宋体; font-size:12pt">即可，</span><span style="font-family:宋体; font-size:12pt">如图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yum</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">install </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">y </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">devel</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">yum</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">选项加入“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">-y</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”是</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">对所有的提问都回答“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">yes</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”，可以</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">避免在安装过程中出现的反复确认，从而加快安装速度。</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">java-1.8.0-openjdk</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">和</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">java-1.8.0-openjdk-devel</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">两个包将被一起安装，同时所需的依赖也会被安装，如下图所示。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image038.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span></div>

<p><span style="font-family:宋体; font-size:12pt">等待安装完成，可以看到</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk</span><span style="font-family:宋体; font-size:12pt">和</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java-1.8.0-openjdk-devel</span><span style="font-family:宋体; font-size:12pt">已经安装</span><span style="font-family:宋体; font-size:12pt">，并且</span><span style="font-family:'Times New Roman'; font-size:12pt">5</span><span style="font-family:宋体; font-size:12pt">个依赖包也一并被安装。</span></p>
<h3 id="6-2-3-查看是否安装成功"><a href="#6-2-3-查看是否安装成功" class="headerlink" title="6.2.3.查看是否安装成功"></a><a name="_Toc29839487"><span style="font-family:黑体; font-size:12pt; font-weight:bold">6.2.3.查看是否安装成功</span></a></h3><div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">java</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -version</span>
<span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">&#xa0;</span></div>

<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">javac</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -version</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image039.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">成功</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span></div>

<p><span style="font-family:宋体; font-size:12pt">说明：</span><span style="font-family:'Times New Roman'; font-size:12pt">yum</span><span style="font-family:宋体; font-size:12pt">方式安装</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">，其默认路径是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/lib/jvm</span><span style="font-family:宋体; font-size:12pt">，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image040.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装路径</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="6-2-4-配置环境变量"><a href="#6-2-4-配置环境变量" class="headerlink" title="6.2.4.配置环境变量"></a><a name="_Toc29839488"><span style="font-family:黑体; font-size:12pt; font-weight:bold">6.2.4.配置环境变量</span></a></h3><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/profile</span><span style="font-family:宋体; font-size:12pt">文件</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">末尾处添加如下内容（文件中</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">#</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">代表注释）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">232</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.b</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">09-0</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.el7_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.x86_64</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">PATH=\$PATH</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:\$</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">JAVA_HOME/bin</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">CLASSPATH=.:\$JAVA_HOME/lib/d</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">t.jar:\$JAVA_HOME/lib/tools.jar</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> JAVA_HOME  CLASSPATH  PATH</span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">使配置生效（也可重启虚拟机）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">source</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">使用</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">echo</span><span style="font-family:宋体; font-size:12pt">命令查看</span><span style="font-family:'Times New Roman'; font-size:12pt">JDK</span><span style="font-family:宋体; font-size:12pt">变量：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">echo</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> $JAVA_HOME</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">echo</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> $PATH</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">echo</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> $CLASSPATH</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">设置完成</span><span style="font-family:宋体; font-size:12pt">后</span><span style="font-family:宋体; font-size:12pt">如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image041.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span></div>

<h2 id="6-3-Slave1和Slave2安装JDK"><a href="#6-3-Slave1和Slave2安装JDK" class="headerlink" title="6.3.Slave1和Slave2安装JDK"></a><a name="_Toc29839489"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">6.3.Slave1</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Slave2</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">JDK</span></a></h2><p><span style="font-family:宋体; font-size:12pt">安装步骤和</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">相同，也可将</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">安装文件夹远程拷贝至</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">节点（不推荐，因为采用</span><span style="font-family:'Times New Roman'; font-size:12pt">yum</span><span style="font-family:宋体; font-size:12pt">安装不仅仅在</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/lib/jvm</span><span style="font-family:宋体; font-size:12pt">文件夹下，如图），按</span><span style="font-family:'Times New Roman'; font-size:12pt">6.2</span><span style="font-family:宋体; font-size:12pt">节步骤</span><span style="font-family:宋体; font-size:12pt">即可</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image042.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">JDK</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">安装文件位置</span></div>

<h1 id="7-配置SSH免密码登录"><a href="#7-配置SSH免密码登录" class="headerlink" title="7.配置SSH免密码登录"></a><a name="_Toc29839490"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">7.</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">SSH</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">免密码登录</span></a></h1><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop </span><span style="font-family:宋体; font-size:12pt">集群中的各个节点之间需要使用</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">SSH </span><span style="font-family:宋体; font-size:12pt">频繁地进行通信，为了避免每次的通信都要求输入密码，需要对</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">各个节点</span><span style="font-family:宋体; font-size:12pt">进行</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">SSH </span><span style="font-family:宋体; font-size:12pt">免密码登录配置。</span></p>
<h2 id="7-1-开启sshd密钥认证"><a href="#7-1-开启sshd密钥认证" class="headerlink" title="7.1.开启sshd密钥认证"></a><a name="_Toc29839491"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">7.1.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">开启</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">sshd</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">密钥</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">认证</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在进行</span><span style="font-family:'Times New Roman'; font-size:12pt">SSH</span><span style="font-family:宋体; font-size:12pt">免密码登录配置之前，需要先开启</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">sshd</span><span style="font-family:宋体; font-size:12pt">密钥</span><span style="font-family:宋体; font-size:12pt">认证</span><span style="font-family:宋体; font-size:12pt">。</span><span style="font-family:宋体; font-size:12pt">编辑每一台机器</span><span style="font-family:宋体; font-size:12pt">（以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例）</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/ssh/sshd_config</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">文件，去掉</span><span style="font-family:宋体; font-size:12pt">原文件</span><span style="font-family:宋体; font-size:12pt">下面这</span><span style="font-family:'Times New Roman'; font-size:12pt">3</span><span style="font-family:宋体; font-size:12pt">行前的“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">#</span><span style="font-family:宋体; font-size:12pt">”注释。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">旧</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">①</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">RSAAuthentication &nbsp;&nbsp;&nbsp;&nbsp;yes<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">&nbsp;&nbsp;②</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># PubkeyAuthentication &nbsp;yes<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">&nbsp;&nbsp;③</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># AuthorizedKeysFile</span><span style="width:2.71pt; text-indent:0pt; display:inline-block"></span><span style="width:21pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">authorized_keys</span>
</div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/ssh/sshd_config</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">内容如图所示，可以看到只有上述三行中的②③行，并没有①</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">RSAAuthentication yes</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。这是因为</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">第</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">代</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ssh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">通讯协议使用的配置项</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">RSA</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">认证（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">RSAAuthentication</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）已废除，</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">第</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">代</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ssh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">通讯协议的密钥验证是</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">PubkeyAuthentication</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。而且第③行默认是开启的（如图第</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">47</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">行），故只需去掉上述第②行的注释（对应文件第</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">43</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">行，如图所示）。</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">参考文章：</span><a target="_blank" rel="noopener" href="https://www.cnblogs.com/Leroscox/p/9627809.html"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://www.cnblogs.com/Leroscox/p/9627809.html</span></a></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image043.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">ssh</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">d</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">综上所述，编辑</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/ssh/sshd_config</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">文件，</span><span style="font-family:宋体; font-size:12pt">去掉第</span><span style="font-family:'Times New Roman'; font-size:12pt">43</span><span style="font-family:宋体; font-size:12pt">行注释即可，如上图①处。另外，按上述文章，还应允许</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">认证登陆</span><span style="font-family:宋体; font-size:12pt">（</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">PermitRootLogin</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">，去掉第</span><span style="font-family:'Times New Roman'; font-size:12pt">38</span><span style="font-family:宋体; font-size:12pt">行注释</span><span style="font-family:宋体; font-size:12pt">即可，</span><span style="font-family:宋体; font-size:12pt">如上图③处。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/ssh/sshd_config</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">设置完成保存后，重启</span><span style="font-family:'Times New Roman'; font-size:12pt">sshd</span><span style="font-family:宋体; font-size:12pt">服务：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">systemctl</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> restart sshd</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注：每个节点都需要配置。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">&#xa0;</span></p>
<h2 id="7-2-创建免密码登录账户"><a href="#7-2-创建免密码登录账户" class="headerlink" title="7.2.创建免密码登录账户"></a><a name="_Toc29839492"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">7.2.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">创建免密码登录账户</span></a></h2><p><span style="font-family:宋体; font-size:12pt">由于</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop </span><span style="font-family:宋体; font-size:12pt">集群中的各节点默认会使用当前的账号</span><span style="font-family:'Times New Roman'; font-size:12pt">SSH</span><span style="font-family:宋体; font-size:12pt">免密码登录其它节点，所以需要在每个节点中创建一个相同的供</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop </span><span style="font-family:宋体; font-size:12pt">集群专用的账户，</span><span style="font-family:宋体; font-size:12pt">我们</span><span style="font-family:宋体; font-size:12pt">使用的账户为</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop </span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注：每个节点都需要</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">创建</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">用户，至此每个节点拥有</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">root</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">两个用户</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">创建用户：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">useradd</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">设置密码：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">pass</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">wd</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image044.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">创建</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">用户并设置密码</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="7-3-生成公钥密钥对"><a href="#7-3-生成公钥密钥对" class="headerlink" title="7.3.生成公钥密钥对"></a><a name="_Toc29839493"><span style="font-family:黑体; font-size:14pt; font-weight:bold">7.3.生成公</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">钥</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">密钥对</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">每个节点上</span><span style="font-family:宋体; font-size:12pt">分别执行</span><span style="font-family:宋体; font-size:12pt">（以</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例）</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><span style="font-family:宋体; font-size:12pt">首先切换到</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户</span><span style="font-family:宋体; font-size:12pt">（注意提示符，</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">#</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">表示</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">用户，</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">表示一般用户）</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">u</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">然后输入以下命令，</span><span style="font-family:宋体; font-size:12pt">根据提示按三次回车键</span><span style="font-family:宋体; font-size:12pt">直到生成结束</span><span style="font-family:宋体; font-size:12pt">，如图所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> root]$ </span><span style="width:19.85pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh-keygen</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -t rsa</span>
<span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">&#xa0;</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image045.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点上</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">生成公</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">钥</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密钥对</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:12pt">三个</span><span style="font-family:宋体; font-size:12pt">节点</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">分别</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">都</span><span style="font-family:宋体; font-size:12pt">执行</span><span style="font-family:宋体; font-size:12pt">上述步骤</span><span style="font-family:宋体; font-size:12pt">后</span><span style="font-family:宋体; font-size:12pt">（</span><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户</span><span style="font-family:宋体; font-size:12pt">身份</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">会</span><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt">每个节点的</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">home/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/.ssh</span><span style="font-family:宋体; font-size:12pt">目录</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">自动</span><span style="font-family:宋体; font-size:12pt">生成两个文件</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">id_rsa</span><span style="font-family:宋体; font-size:12pt">和</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">id_rsa.pub</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">其中前者为私</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">，后者为公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">，如上图所示。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">节点上</span><span style="font-family:宋体; font-size:12pt">生成公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">密钥对</span><span style="font-family:宋体; font-size:12pt">如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image046.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点上创建</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">用户并</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">生成公</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">钥</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密钥对</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">节点上</span><span style="font-family:宋体; font-size:12pt">生成公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">密钥对</span><span style="font-family:宋体; font-size:12pt">如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image047.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点上创建</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">用户并</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">生成公</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">钥</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">密钥对</span></div>

<h2 id="7-4-将公钥导入认证文件"><a href="#7-4-将公钥导入认证文件" class="headerlink" title="7.4.将公钥导入认证文件"></a><a name="_Toc29839494"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">7.4.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">将公</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">钥</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">导入认证文件</span></a></h2><p><span style="font-family:宋体; font-size:12pt">密钥</span><span style="font-family:宋体; font-size:12pt">生成之后，</span><span style="font-family:宋体; font-size:12pt">需要</span><span style="font-family:宋体; font-size:12pt">将</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">每台机器</span><span style="font-family:宋体; font-size:12pt">的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">都拷贝到</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">主节点</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">认证文件</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">authorized_keys </span><span style="font-family:宋体; font-size:12pt">中</span><span style="font-family:宋体; font-size:12pt">，以下操作都</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">在主节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:12pt">上由</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户完成</span><span style="font-family:宋体; font-size:12pt">（如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7-6</span><span style="font-family:宋体; font-size:12pt">所示）</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">①将</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">导入</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">主节点</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">认证文件中</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cat</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /home/hadoop/.ssh/id_rsa.pub &gt;&gt; /home/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/.ssh/authorized_keys</span></div>

<p><span style="font-family:宋体; font-size:12pt">②将</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">导入</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">主节点</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">认证文件中</span><span style="font-family:宋体; font-size:12pt">（根据提示输入“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yes</span><span style="font-family:宋体; font-size:12pt">”及密码）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop@slave1 </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cat /home/hadoop/.ssh/id_rsa.pu</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">b &gt;&gt; /home/hadoop/.ssh/authorized_keys</span></div>

<p><span style="font-family:宋体; font-size:12pt">③将</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">导入</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">主节点</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">认证文件中</span><span style="font-family:宋体; font-size:12pt">（根据提示输入“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yes</span><span style="font-family:宋体; font-size:12pt">”及密码）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop@slave2 </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cat /home/hadoop/.ssh/id_rsa.pu</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">b &gt;&gt; /home/hadoop/.ssh/authorized_keys</span></div>

<p><span style="font-family:宋体; font-size:12pt">④各节点的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">导入完成后，查看认证文件内容，可以看到各个节点的</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户的公</span><span style="font-family:宋体; font-size:12pt">钥</span><span style="font-family:宋体; font-size:12pt">信息，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7-6</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cat</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /home/hadoop/.ssh/authorized_keys</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image048.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">将每台机器的公</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">钥</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">都拷贝到主节点的认证文件</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">中</span></div>

<h2 id="7-5-设置权限并补全Master信息"><a href="#7-5-设置权限并补全Master信息" class="headerlink" title="7.5.设置权限并补全Master信息"></a><a name="_Toc29839495"><span style="font-family:黑体; font-size:14pt; font-weight:bold">7.5.设置权限并补全</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Master</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">信息</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机上执行如下命令，对认证文件的操作权限进行设置</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7.7</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 700 /home/hadoop/.ssh</span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold"><br>输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 600 /home/hadoop/.ssh/authorized_keys</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">查看</span><span style="font-family:'Times New Roman'; font-size:12pt">known_hosts</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">中主机列表</span><span style="font-family:宋体; font-size:12pt">，发现只有</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">而没有</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">自身（如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7.7</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">箭头处</span><span style="font-family:宋体; font-size:12pt">），</span><span style="font-family:宋体; font-size:12pt">所以需要</span><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">主机上</span><span style="font-family:'Times New Roman'; font-size:12pt">ssh</span><span style="font-family:宋体; font-size:12pt">免密登录</span><span style="font-family:宋体; font-size:12pt">自己，</span><span style="font-family:宋体; font-size:12pt">将自身的主机信息添加到</span><span style="font-family:'Times New Roman'; font-size:12pt">known_hosts</span><span style="font-family:宋体; font-size:12pt">列表中。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> master</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：登陆成功后的状态是以</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">hadoop@master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">的身份</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ssh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">登陆</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">hadoop@master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，所以提示符都是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">[hadoop@master ~]$</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。登陆成功后即将其信息写入到</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">known_hosts</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">中</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">（注意</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ssh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">登陆时的警告），所以还要输入</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">exit</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">退出远程登陆回到当前的</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">hadoop@master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">身份</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">退出后，再次查看</span><span style="font-family:'Times New Roman'; font-size:12pt">known_hosts</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">中</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">可以看到已成功将</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">节点信息写入其主机列表中，如图所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image049.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">设置认证文件权限并</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">在</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">known_hosts</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">中</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">补全</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="7-6-将认证文件复制到slave节点"><a href="#7-6-将认证文件复制到slave节点" class="headerlink" title="7.6.将认证文件复制到slave节点"></a><a name="_Toc29839496"><span style="font-family:黑体; font-size:14pt; font-weight:bold">7.6.将认证文件复制到</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">slave</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">节点</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机上执行以下命令将生成的</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">authorized_keys</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">文件从</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机复制到</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">节点，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7.8</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /home/hadoop/.ssh/authorized_keys hadoop@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/home/hadoop/.ssh/authorized_keys<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /home/hadoop/.ssh/authorized_keys hadoop@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/home/hadoop/.ssh/authorized_keys<br></span>
</div>

<p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机上</span><span style="font-family:宋体; font-size:12pt">测试</span><span style="font-family:'Times New Roman'; font-size:12pt">ssh</span><span style="font-family:宋体; font-size:12pt">远程登陆</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">节点，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">7.8</span><span style="font-family:宋体; font-size:12pt">所示，可以发现不需要登陆密码了。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">sh</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> slave1<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ssh</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> slave2</span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image050.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">将认证文件复制到其他节点</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">并远程登陆测试</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机上执行以下命令将生成的</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">known_hosts</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">文件从</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">主机复制到</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">节点</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /home/hadoop/.ssh/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">known_hosts</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">home/hadoop/.ssh/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">known_hosts<br></span>
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp /home/hadoop/.ssh/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">known_hosts</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> hadoop@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">home/hadoop/.ssh/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">known_hosts</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<h2 id="7-7-设置从节点认证文件权限"><a href="#7-7-设置从节点认证文件权限" class="headerlink" title="7.7.设置从节点认证文件权限"></a><a name="_Toc29839497"><span style="font-family:黑体; font-size:14pt; font-weight:bold">7.7.设置从节点认证文件权限</span></a></h2><p><span style="font-family:宋体; font-size:12pt">设置</span><span style="font-family:宋体; font-size:12pt">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">认证文件权限：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@slave1 ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 700 /home/hadoop/.ssh<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@slave1 ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 600 /home/hadoop/.ssh/authorized_keys</span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">设置</span><span style="font-family:宋体; font-size:12pt">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">认证文件权限：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@slave2 ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 700 /home/hadoop/.ssh<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@slave2 ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chmod</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> 600 /home/hadoop/.ssh/authorized_keys</span>
</div>

<h2 id="7-8-三节点互相ssh登陆测试"><a href="#7-8-三节点互相ssh登陆测试" class="headerlink" title="7.8.三节点互相ssh登陆测试"></a><a name="_Toc29839498"><span style="font-family:黑体; font-size:14pt; font-weight:bold">7.8.三节点互相</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">ssh</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">登陆测试</span></a></h2><p><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">登陆</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">及</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">，如下图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image051.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">登陆</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">登陆</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">及</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">，如下图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image052.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">登陆</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">登陆</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">及</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">，如下图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image053.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7.11</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">登陆</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="8-安装Hadoop"><a href="#8-安装Hadoop" class="headerlink" title="8.安装Hadoop"></a><a name="_Toc29839499"><span style="font-family:黑体; font-size:16pt; font-weight:bold">8.安装</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">Hadoop</span></a></h1><p><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">安装其实就是一个将下载好的</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">压缩包解压到所有服务器上并进行配置的过程，推荐将</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">安装在各个节点服务器的相同目录下方便配置</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">我们</span><span style="font-family:宋体; font-size:12pt">使用的</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">版本是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">，指定的</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">的安装目录</span><span style="font-family:宋体; font-size:12pt">（以</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">身份安装）</span><span style="font-family:宋体; font-size:12pt">是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<h2 id="8-1-下载压缩包"><a href="#8-1-下载压缩包" class="headerlink" title="8.1.下载压缩包"></a><a name="_Toc29839500"><span style="font-family:黑体; font-size:14pt; font-weight:bold">8.1.下载压缩包</span></a></h2><p><span style="font-family:宋体; font-size:12pt">可</span><span style="font-family:宋体; font-size:12pt">从官网下载</span><span style="font-family:宋体; font-size:12pt">压缩包，</span><span style="font-family:宋体; font-size:12pt">下载地址</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><a target="_blank" rel="noopener" href="https://www-us.apache.org/dist/hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.gz"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://www-us.apache.org/dist/hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.gz</span></a></p>
<p><span style="font-family:宋体; font-size:12pt">推荐从本地镜像站点下载</span><span style="font-family:宋体; font-size:12pt">，不仅</span><span style="font-family:宋体; font-size:12pt">稳定而且下载速度比较快</span><span style="font-family:宋体; font-size:12pt">。</span><span style="font-family:宋体; font-size:12pt">可从清华大学镜像站下载</span><span style="font-family:宋体; font-size:12pt">压缩包</span><span style="font-family:宋体; font-size:12pt">（耗时</span><span style="font-family:'Times New Roman'; font-size:12pt">38s</span><span style="font-family:宋体; font-size:12pt">）</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">下载</span><span style="font-family:宋体; font-size:12pt">地址</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.gz"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.gz</span></a></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">利用</span><span style="font-family:'Times New Roman'; font-size:12pt">wget</span><span style="font-family:宋体; font-size:12pt">下载</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">必须首先安装</span><span style="font-family:'Times New Roman'; font-size:12pt">wget</span><span style="font-family:宋体; font-size:12pt">（以测试机</span><span style="font-family:'Times New Roman'; font-size:12pt">Tester</span><span style="font-family:宋体; font-size:12pt">为例）：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yum</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">y </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">install wget</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">利用</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">wget</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">下载是将文件下载到当前目录，因此要先进入</span><span style="font-family:宋体; font-size:12pt; font-weight:bold"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">/usr/local </span><span style="font-family:宋体; font-size:12pt; font-weight:bold">目录，然后执行下载命令，如</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">下</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">图所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> ~]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cd</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /usr/local</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span><br>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">wget</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">https://mirrors.tuna.tsinghua.edu.cn/apache/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop/common/hadoop-2.7.7/hadoop-2.7.7.tar.g</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">z</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">下载完成后，在</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">路径下就有了该压缩包，如下图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image054.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Tester</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">压缩包</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="8-2-解压Hadoop压缩包"><a href="#8-2-解压Hadoop压缩包" class="headerlink" title="8.2.解压Hadoop压缩包"></a><a name="_Toc29839501"><span style="font-family:黑体; font-size:14pt; font-weight:bold">8.2.解压</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Hadoop</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">压缩包</span></a></h2><p><span style="font-family:宋体; font-size:12pt">执行以下命令解压</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">压缩包</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tar zxvf </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7.tar.gz</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">等待解压完成，会在当前目录</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">多</span><span style="font-family:宋体; font-size:12pt">出</span><span style="font-family:宋体; font-size:12pt">一个</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">文件夹，里面即为解压的内容，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image055.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">解压</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">压缩包</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="8-3-更改用户组"><a href="#8-3-更改用户组" class="headerlink" title="8.3.更改用户组"></a><a name="_Toc29839502"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">8.3.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">更改用户组</span></a></h2><p><span style="font-family:宋体; font-size:12pt">由于</span><span style="font-family:宋体; font-size:12pt">解压时使用的是</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">root </span><span style="font-family:宋体; font-size:12pt">账户，</span><span style="font-family:宋体; font-size:12pt">所以</span><span style="font-family:宋体; font-size:12pt">还需要执行以下命令将</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">的安装目录的所有者和所属组改为</span><span style="font-family:宋体; font-size:12pt"> </span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop /usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注①</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">在图</span><span style="font-family:'Times New Roman'; font-size:12pt">8.3</span><span style="font-family:宋体; font-size:12pt">中，查看文件</span><span style="font-family:宋体; font-size:12pt">详细</span><span style="font-family:宋体; font-size:12pt">信息</span><span style="font-family:宋体; font-size:12pt">中</span><span style="font-family:宋体; font-size:12pt">的所有者和所属组</span><span style="font-family:宋体; font-size:12pt">，第一个</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ro</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ot</span><span style="font-family:宋体; font-size:12pt">为所属用户（</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">User</span><span style="font-family:宋体; font-size:12pt">），第二个</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">为所属组（</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Group</span><span style="font-family:宋体; font-size:12pt">）。</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注②</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">安装</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">时，都是以</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">用户的身份安装，但在实际中操作</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">是以</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户的身份运行的，因此在</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">安装完成后都需要更改用户组（后文也有说明）。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image056.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">更改用户组</span></div>

<h2 id="8-4-配置环境变量"><a href="#8-4-配置环境变量" class="headerlink" title="8.4.配置环境变量"></a><a name="_Toc29839503"><span style="font-family:黑体; font-size:14pt; font-weight:bold">8.4.配置环境变量</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑配置文件</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/profile</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">以</span><span style="font-family:宋体; font-size:12pt">配置环境变量：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span></div>

<p><span style="font-family:宋体; font-size:12pt">在末尾处加入以下内容</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> HADOOP_HOME=/usr/local/hadoop-2.7.7</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">PATH=\$PATH:\$HOME/.local/bin:\$HOME/bin:\$HADOOP_HOME/bin:$HADOOP_HOME/sbin</span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> PATH</span>
</div>

<p><span style="font-family:宋体; font-size:12pt">保存退出后</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">使之生效</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">source</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span></div>

<p><span style="font-family:宋体; font-size:12pt">由此完成安装</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">查看</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">版本信息：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="font-family:Consolas; font-size:12pt">tester</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> version</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">由于</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Tester</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">未安装</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">java</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">环境（见</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">6.1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">），</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">因此看不到</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">版本信息</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，输出错误信息：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">Error: JAVA_HOME is not set and could not be found</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image057.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="8-5-实际安装Hadoop的说明"><a href="#8-5-实际安装Hadoop的说明" class="headerlink" title="8.5.实际安装Hadoop的说明"></a><a name="_Toc29839504"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">8.5.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">实际</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Hadoop</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">的</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">说明</span></a></h2><h3 id="8-5-1-安装位置的问题"><a href="#8-5-1-安装位置的问题" class="headerlink" title="8.5.1.安装位置的问题"></a><a name="_Toc29839505"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">8.5.1.</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">安装位置的问题</span></a></h3><p><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">安装</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">时，在</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">目录下新建了一个文件夹</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">，使得将压缩包放到了</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">下而不是</span><span style="font-family:宋体; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">，导致解压后变成了</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">而不是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">，如图所示（图中应该是创建</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">文件夹）。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image058.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">压缩包（标注有误）</span></div>

<p><span style="font-family:宋体; font-size:12pt">利用</span><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">远程拷贝文件时也犯</span><span style="font-family:宋体; font-size:12pt">了同样的错误，都是拷贝到了</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">下，如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image059.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">远程上</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">传</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">压缩包至</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">及</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">（位置错误）</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image060.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点传输前后（位置错误）</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image061.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点传输前后（位置错误）</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="8-5-2解决安装位置的问题"><a href="#8-5-2解决安装位置的问题" class="headerlink" title="8.5.2解决安装位置的问题"></a><a name="_Toc29839506"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">8.5.2</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">解决安装位置的问题</span></a></h3><p><span style="font-family:宋体; font-size:12pt">对于</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">每个节点</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">首先</span><span style="font-family:宋体; font-size:12pt">将位于</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">下的压缩包移动到</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">，然后删除</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件夹</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示（截图为</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">）：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image062.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">解决安装位置的问题</span></div>

<p><span style="font-family:宋体; font-size:12pt">解压完成后删除压缩包，如图所示（截图为</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">）：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image063.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">解压完成后删除压缩包</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="8-5-3-各个节点"><a href="#8-5-3-各个节点" class="headerlink" title="8.5.3.各个节点"></a><a name="_Toc29839507"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">8.5.3.</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">各个节点</span></a></h3><p><span style="font-family:宋体; font-size:12pt">①更改位置</span><span style="font-family:宋体; font-size:12pt">，如上</span><span style="font-family:'Times New Roman'; font-size:12pt">8.5.2</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">；</span></p>
<p><span style="font-family:宋体; font-size:12pt">②</span><span style="font-family:宋体; font-size:12pt">解压</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7.tar.gz</span><span style="font-family:宋体; font-size:12pt">文件，完成后删除压缩包；</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">③更改用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">；</span></p>
<p><span style="font-family:宋体; font-size:12pt">④配置环境变量并使之生效；</span></p>
<p><span style="font-family:宋体; font-size:12pt">⑤查看</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">版本。</span></p>
<p><span style="font-family:宋体; font-size:12pt">设置完成后如图</span><span style="font-family:'Times New Roman'; font-size:12pt">8.11~8.13</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image064.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.11</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image065.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.12</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image066.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">8.13</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="8-5-4-从节点Hadoop的安装"><a href="#8-5-4-从节点Hadoop的安装" class="headerlink" title="8.5.4.从节点Hadoop的安装"></a><a name="_Toc29839508"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">8.5.4.</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Hadoop</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">的安装</span></a></h3><p><span style="font-family:宋体; font-size:12pt">当主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">安装完成后，可以直接利用</span><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">将整个</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-2.7.7</span><span style="font-family:宋体; font-size:12pt">文件夹传到</span><span style="font-family:宋体; font-size:12pt">从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">，而不需要再次安装。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="9-配置Hadoop集群"><a href="#9-配置Hadoop集群" class="headerlink" title="9.配置Hadoop集群"></a><a name="_Toc29839509"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">9.</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">H</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">adoop</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">集群</span></a></h1><p><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">的配置文件位于</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="font-family:宋体; font-size:12pt">文件夹下</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">默认配置不需要修改，</span><span style="font-family:宋体; font-size:12pt">主要配置节点的个性配置</span><span style="font-family:宋体; font-size:12pt">，即</span><span style="font-family:宋体; font-size:12pt">①</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">core-site.xml</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">②</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hdfs-site.xml</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">③</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">mapred-site.xml.template</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:宋体; font-size:12pt">④</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yarn-site.xml</span><span style="font-family:宋体; font-size:12pt">四个文件，以及</span><span style="font-family:宋体; font-size:12pt">⑤</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slaves</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:宋体; font-size:12pt">⑥</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-env.sh</span><span style="font-family:宋体; font-size:12pt">两个文件，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image067.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">需要配置的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">个文件</span></div>

<h2 id="9-1-配置core-site-xml"><a href="#9-1-配置core-site-xml" class="headerlink" title="9.1.配置core-site.xml"></a><a name="_Toc29839510"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.1.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">core-site.</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">xml</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">配置文件</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">core-site.xml</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">在</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="font-family:宋体; font-size:12pt">和</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="font-family:宋体; font-size:12pt">之间加入以下</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:宋体; font-size:12pt">内容</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">（其中，按“</span><span style="font-family:'Times New Roman'; font-size:12pt">Tab</span><span style="font-family:宋体; font-size:12pt">”键缩进，</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;!— </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">xxx</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">—&gt;</span><span style="font-family:宋体; font-size:12pt">的内容为注释）</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--</span><span style="font-family:Consolas; font-size:12pt"> The name of the default file system --&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">name&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">fs.defaultFS&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hdfs://</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">master</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:9000&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--</span><span style="font-family:Consolas; font-size:12pt"> The size of buffer for use in sequence files --&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;io.file.buffer.size&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">131072&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--</span><span style="font-family:Consolas; font-size:12pt"> A base for other temporary directories --&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;hadoop.tmp.dir&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;file:/usr</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/tmp&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;/configuration&gt;<br></span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image068.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">core-site.xml</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-2-配置hdfs-site-xml"><a href="#9-2-配置hdfs-site-xml" class="headerlink" title="9.2.配置hdfs-site.xml"></a><a name="_Toc29839511"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.2.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">hdfs-site.</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">xml</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/hdfs</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-site.xml</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">加入以下配置内容</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">9.3</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.namenode.name.dir&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;file:/usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/data/namespace&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Path on the local filesystem where the NameNode </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">stores&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.datanode.data.dir&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value&gt;/usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/data/dataspace&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Path on the local filesystem where the DataNode stores Data&lt;/description&gt;<br>/span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.namenode.secondary.http-address&lt;/name&gt;<br>/span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:50090&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The secondary namenode http server address and port&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;dfs.webhdfs.enabled&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Enable WebHDFS (REST API) in Namenodes and Datanodes&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">name&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">dfs.permissions&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">false&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Disable permission checking in HDFS&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">name&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">dfs.replication&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">2&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Default block replication&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;/configuration&gt;<br></span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image069.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hdfs-site.xml</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-3-配置mapred-site-xml"><a href="#9-3-配置mapred-site-xml" class="headerlink" title="9.3.配置mapred-site.xml"></a><a name="_Toc29839512"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.3.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">mapred-site.xml</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">mapred-site.xml.template</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">加入以下配置内容</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">9.4</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt">此模板文件</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">mapred-site.xml.template</span><span style="font-family:宋体; font-size:12pt">应将其重命名为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">mapred-site.xml</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;mapreduce.framework.name&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yarn&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The runtime framework for executing MapReduce jobs&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;/configuration&gt;<br></span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image070.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">mapred-site.xml.template</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-4-配置yarn-site-xml"><a href="#9-4-配置yarn-site-xml" class="headerlink" title="9.4.配置yarn-site.xml"></a><a name="_Toc29839513"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.4.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">yarn-site.</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">xml</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">yarn-site.xml</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">加入以下配置内容</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">9.5</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">configuration</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.resourcemanager.scheduler.address&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:8030&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The address of the scheduler interface&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.resourcemanager.resource-tracker.address&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:8031&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The address </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">and</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> port of Resource Manager of YARN at Slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.resourcemanager.address&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:8032&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The address of the applications manager interface in the RM&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.resourcemanager.admin.address&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:8033&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The address of the RM admin interface&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.resourcemanager.webapp.address&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:8088&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">The http address of the RM web application&lt;/description&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">property</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">value&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">mapreduce_shuffle&lt;/value&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">final&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">true&lt;/final&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Node Manager of YARN&lt;/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">description</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;&lt;/property&gt;<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&lt;/configuration&gt;<br></span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image071.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">yarn-site.xml</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-5-配置slaves"><a href="#9-5-配置slaves" class="headerlink" title="9.5.配置slaves"></a><a name="_Toc29839514"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.5.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">slaves</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/slaves</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，删除原有的</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost</span><span style="font-family:宋体; font-size:12pt">（也可以直接注释掉）加入</span><span style="font-family:宋体; font-size:12pt">以下内容</span><span style="font-family:宋体; font-size:12pt">，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/slaves</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">旧</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">新</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">master<br></span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;slave1<br></span>
<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&nbsp;&nbsp;&nbsp;&nbsp;slave2<br></span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image072.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">slaves</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-6-配置hadoop-env-sh"><a href="#9-6-配置hadoop-env-sh" class="headerlink" title="9.6.配置hadoop-env.sh"></a><a name="_Toc29839515"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.6.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">hadoop-env.</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">sh</span></a></h2><p><span style="font-family:宋体; font-size:12pt">编辑</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop-env.sh</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">将</span><span style="font-family:宋体; font-size:12pt">“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"># The java implementation to use.</span><span style="font-family:宋体; font-size:12pt">”下</span><span style="font-family:宋体; font-size:12pt">的</span><span style="font-family:宋体; font-size:12pt">“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">export JAVA_HOME=${JAVA_HOME}</span><span style="font-family:宋体; font-size:12pt">”修改</span><span style="font-family:宋体; font-size:12pt">为：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">export JAVA_HOME=/usr/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">lib</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">其中，路径</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">lib</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64</span><span style="font-family:宋体; font-size:12pt">为安装</span><span style="font-family:'Times New Roman'; font-size:12pt">Java</span><span style="font-family:宋体; font-size:12pt">时设置的环境变量（见</span><span style="font-family:'Times New Roman'; font-size:12pt">6.2.4</span><span style="font-family:宋体; font-size:12pt">节），如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image073.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">hadoop-env.sh</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="9-7-将配置分发到其他节点"><a href="#9-7-将配置分发到其他节点" class="headerlink" title="9.7.将配置分发到其他节点"></a><a name="_Toc29839516"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">9.7.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">将配置分发到其他节点</span></a></h2><p><span style="font-family:宋体; font-size:12pt">上述</span><span style="font-family:'Times New Roman'; font-size:12pt">9.1~9.6</span><span style="font-family:宋体; font-size:12pt">都是在主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上配置，</span><span style="font-family:宋体; font-size:12pt">因此需要将其分发到</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">两个</span><span style="font-family:宋体; font-size:12pt">从节点，如图所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -r /usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/hadoop/* </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/hadoop/</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]#</span><span style="width:17.44pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -r /usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/hadoop/* </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:/usr/local/hadoop-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">7.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/etc/hadoop/</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image074.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">9.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">将</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置分发到</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上图中，尚未配置</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">/usr/local/hadoop-2.7.7/etc/hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">hadoop-env.sh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">因此</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scp</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">后需要对每个节点的</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">hadoop-env.sh</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">进行配置</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。若先将</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">的</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">此</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">配置好</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">然后</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scp</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">到从节点</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">则不需在从节点上配置该文件</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="10-操作Hadoop集群"><a href="#10-操作Hadoop集群" class="headerlink" title="10.操作Hadoop集群"></a><a name="_Toc29839517"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">10.</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">操作</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">Hadoop</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">集群</span></a></h1><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">以下</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">操作</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">都是使用</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">用户，提示符为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">[hadoop@master ~]$</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<h2 id="10-1-格式化NameNode"><a href="#10-1-格式化NameNode" class="headerlink" title="10.1.格式化NameNode"></a><a name="_Toc29839518"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">10.1.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">格式化</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">NameNode</span></a></h2><p><span style="font-family:宋体; font-size:12pt">第一次启动</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">需要先进行格式化，使用</span><span style="font-family:宋体; font-size:12pt">格式为“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$HADOOP_PREFIX/bin/hdfs namenode -format &lt;cluster_name&gt;</span><span style="font-family:宋体; font-size:12pt">”的如下</span><span style="font-family:宋体; font-size:12pt">命令：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hdfs</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> namenode -format </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">master</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">等待</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">格式化完成，出现</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">Exiting with status 0</span><span style="font-family:宋体; font-size:12pt">的信息即为</span><span style="font-family:宋体; font-size:12pt">格式化成功</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.1</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image075.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">格式化</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">NameNode</span></div>

<h2 id="10-2-启动HDFS集群"><a href="#10-2-启动HDFS集群" class="headerlink" title="10.2.启动HDFS集群"></a><a name="_Toc29839519"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">10.2.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">HDFS</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">集群</span></a></h2><p><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">格式化</span><span style="font-family:宋体; font-size:12pt">完成后</span><span style="font-family:宋体; font-size:12pt">，使用</span><span style="font-family:宋体; font-size:12pt">格式为“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">HADOOP_PREFIX/sbin/start-dfs.sh</span><span style="font-family:宋体; font-size:12pt">”的如下</span><span style="font-family:宋体; font-size:12pt">命令</span><span style="font-family:宋体; font-size:12pt">来启动</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tart</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">dfs</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.sh</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：使用该</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">命令启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群时，在集群的任意节点上执行都能够启动集群。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image076.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">在</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span></div>

<p><span style="font-family:宋体; font-size:12pt">此时</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">各节点</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如表</span><span style="font-family:'Times New Roman'; font-size:12pt">10.1</span><span style="font-family:宋体; font-size:12pt">所示，</span><span style="font-family:宋体; font-size:12pt">如图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.2</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:宋体; font-size:12pt">图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.3</span><span style="font-family:宋体; font-size:12pt">、图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.4</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image077.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image078.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">0.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群后各节点上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">名称</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">master</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">J</span><span style="font-family:'Times New Roman'; font-size:10.5pt">ps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">NameNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave1</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">SecondaryNameNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave2</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:233.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td></tr></tbody></table></div>

<p><span style="font-family:宋体; font-size:12pt">此时可在浏览器中打开</span><a target="_blank" rel="noopener" href="http://192.168.176.200:50070"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://192.168.176.200:50070</span></a><span style="font-family:宋体; font-size:12pt">查看</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">的管理界面</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image079.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">浏览器查看</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的管理界面</span></div>

<h2 id="10-3-启动YARN"><a href="#10-3-启动YARN" class="headerlink" title="10.3.启动YARN"></a><a name="_Toc29839520"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">10.3.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">YARN</span></a></h2><p><span style="font-family:宋体; font-size:12pt">启动</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">后，</span><span style="font-family:宋体; font-size:12pt">使用</span><span style="font-family:宋体; font-size:12pt">格式为“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">HADOOP_PREFIX/sbin/start-yarn.sh</span><span style="font-family:宋体; font-size:12pt">”的如下</span><span style="font-family:宋体; font-size:12pt">命令</span><span style="font-family:宋体; font-size:12pt">来启动</span><span style="font-family:'Times New Roman'; font-size:12pt">YARN</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@slave2 ~]$ </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tart</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-yarn.sh</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">在使用</span><span style="font-family:宋体; font-size:12pt; font-weight:bold"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">start-yarn.sh</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold"> </span><span style="font-family:宋体; font-size:12pt; font-weight:bold">命令启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群时，必须在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ResourceManager</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">所在节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">S</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">lave2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上执行该命令才能够启动</span><span style="font-family:宋体; font-size:12pt; font-weight:bold"> </span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ResourceManager</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">；当</span><span style="font-family:宋体; font-size:12pt; font-weight:bold"> </span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Namenode</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ResourceManger</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">不在同一台主机时，就不能在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">NameNode</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上启动</span><span style="font-family:宋体; font-size:12pt; font-weight:bold"> </span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">了，应该在</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">ResouceManager</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">所在的机器</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">S</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">lave2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">上启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image080.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">在</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">此时</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">各节点</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如表</span><span style="font-family:'Times New Roman'; font-size:12pt">10.2</span><span style="font-family:宋体; font-size:12pt">所示，</span><span style="font-family:宋体; font-size:12pt">如图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.6</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:宋体; font-size:12pt">图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.7</span><span style="font-family:宋体; font-size:12pt">、图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.8</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">0.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群后各节点上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程（红色表示新增）</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">名称</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:285.8pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">master</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:285.8pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">J</span><span style="font-family:'Times New Roman'; font-size:10.5pt">ps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">NameNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="color:#ff0000; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave1</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:285.8pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">SecondaryNameNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="color:#ff0000; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:102.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave2</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:285.8pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="font-family:'Times New Roman'; font-size:10.5pt">DataNode</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="color:#ff0000; font-family:'Times New Roman'; font-size:10.5pt">ResourceManager</span><span style="font-family:宋体; font-size:10.5pt">，</span><span style="color:#ff0000; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td></tr></tbody></table></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image081.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image082.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">此时可在浏览器中打开</span><a target="_blank" rel="noopener" href="http://192.168.176.200:50070"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://192.168.176.20</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">2</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">:</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">8088</span></a><span style="font-family:宋体; font-size:12pt">查看</span><span style="font-family:'Times New Roman'; font-size:12pt">YARN</span><span style="font-family:宋体; font-size:12pt">的管理界面</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image083.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">10.9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">浏览器查看</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的管理界面</span></div>

<h1 id="11-各节点scala安装"><a href="#11-各节点scala安装" class="headerlink" title="11.各节点scala安装"></a><a name="_Toc29839521"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">11.</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">各节点</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">scala</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">安装</span></a></h1><h2 id="11-1-主节点Master上安装scala"><a href="#11-1-主节点Master上安装scala" class="headerlink" title="11.1.主节点Master上安装scala"></a><a name="_Toc29839522"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">11.1.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">主节点</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Master</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">上</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">scala</span></a></h2><h3 id="11-1-1下载scala"><a href="#11-1-1下载scala" class="headerlink" title="11.1.1下载scala"></a><a name="_Toc29839523"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">11.1.1</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scala</span></a></h3><p><span style="font-family:宋体; font-size:12pt">打开</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">官网：</span><a target="_blank" rel="noopener" href="http://www.scala-lang.org/download/2.12.10.html"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://www.scala-lang.org/download/</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">2.12.10.html</span></a><span style="font-family:宋体; font-size:12pt">，找到对应版本，如图所示，对应的下载链接为：</span><a target="_blank" rel="noopener" href="https://downloads.lightbend.com/scala/2.12.10/scala-2.12.10.tgz"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://downloads.lightbend.com/scala/2.12.10/scala-2.12.10.tgz</span></a><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image084.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">官网</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">安装路径是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">12</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">10</span><span style="font-family:宋体; font-size:12pt">。首先进入安装目录</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">，使用</span><span style="font-family:'Times New Roman'; font-size:12pt">wget</span><span style="font-family:宋体; font-size:12pt">下载，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cd</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">local</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">wget</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">https://downloads.lightbend.com/scala/2.12.10/scala-2.12.10.tgz</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image085.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">由于没有采用镜像站点资源下载，因此下载速度较慢，耐心等待下载完成。下载完成后会在当前目录生成</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">文件：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">12</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">10.tgz</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h3 id="11-1-2解压scala压缩包"><a href="#11-1-2解压scala压缩包" class="headerlink" title="11.1.2解压scala压缩包"></a><a name="_Toc29839524"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">11.1.2</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">解压</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scala</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">压缩包</span></a></h3><p><span style="font-family:宋体; font-size:12pt">解压</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">到当前文件夹，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图</span><span style="font-family:'Times New Roman'; font-size:12pt">11.3</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tar</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">zvxf scala-2.12.10.tgz</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">解压完成后，</span><span style="font-family:宋体; font-size:12pt">会在当前目录创建文件夹</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-2.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">12</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">10</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">压缩包内的所有文件都被解压到该目录。</span></p>
<p><span style="font-family:宋体; font-size:12pt">解压完成后，</span><span style="font-family:宋体; font-size:12pt">删除原压缩包</span><span style="font-family:宋体; font-size:12pt">，执行如下命令：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">rm</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">f scala-2.12.10.tgz</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明：</span><span style="font-family:宋体; font-size:12pt">删除命令选项“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">f</span><span style="font-family:宋体; font-size:12pt">”表示强制删除，</span><span style="font-family:宋体; font-size:12pt">删除过程中没有“是否确认删除”的提示。</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">慎用此选项，</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">尽量只</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">在删除有很多子文件夹时配合“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:bold">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:bold">r</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">”（递归处理）使用。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image086.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">解压</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h3 id="11-1-3配置scala环境变量"><a href="#11-1-3配置scala环境变量" class="headerlink" title="11.1.3配置scala环境变量"></a><a name="_Toc29839525"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">11.1.3</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scala</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">环境变量</span></a></h3><p><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">，加入</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">export </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">PATH=$PATH:/usr/local/scala-2.12.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">10</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/bin</span><span style="font-family:宋体; font-size:12pt">，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">配置完成后，使之生效</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">source</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">至此，</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">安装完成，查看</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">版本，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -version</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image087.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="11-2从节点上安装scala"><a href="#11-2从节点上安装scala" class="headerlink" title="11.2从节点上安装scala"></a><a name="_Toc29839526"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">11.2</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">从节点上安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">scala</span></a></h2><h3 id="11-2-1-scp传输scala安装文件"><a href="#11-2-1-scp传输scala安装文件" class="headerlink" title="11.2.1.scp传输scala安装文件"></a><a name="_Toc29839527"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">11.2.1.scp</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">传输</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">scala</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">安装文件</span></a></h3><p><span style="font-family:宋体; font-size:12pt">将主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上安装好的</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">文件夹利用</span><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传到从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">上，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图</span><span style="font-family:'Times New Roman'; font-size:12pt">11.5</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r scala-2.12.10 slave1:/usr/local</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r scala-2.12.10 slave2:/usr/local</span>
</div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：此处使用的是相对路径</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，因为当前目录为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">/usr/local</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，也可使用如下</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">命令（</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">绝对路径</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">来传输，二者没有区别：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r /usr/local/scala-2.12.10 slave1:/usr/local</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r /usr/local/scala-2.12.10 slave2:/usr/local</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image088.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scp</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">传输</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">到从节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span></div>

<h3 id="11-2-2配置环境变量"><a href="#11-2-2配置环境变量" class="headerlink" title="11.2.2配置环境变量"></a><a name="_Toc29839528"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">11.2.2</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">配置环境变量</span></a></h3><p><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传输完成后</span><span style="font-family:宋体; font-size:12pt">，在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">，步骤同</span><span style="font-family:'Times New Roman'; font-size:12pt">11.1.3</span><span style="font-family:宋体; font-size:12pt">节，如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image089.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传输完成后</span><span style="font-family:宋体; font-size:12pt">，在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave</span><span style="font-family:'Times New Roman'; font-size:12pt">2</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">，步骤同</span><span style="font-family:'Times New Roman'; font-size:12pt">11.1.3</span><span style="font-family:宋体; font-size:12pt">节，如图所示：</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image090.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">11.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h1 id="12-Spark安装及配置"><a href="#12-Spark安装及配置" class="headerlink" title="12.Spark安装及配置"></a><a name="_Toc29839529"><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">12.Spark</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">安装及配置</span></a></h1><h2 id="12-1-主节点Master上安装spark"><a href="#12-1-主节点Master上安装spark" class="headerlink" title="12.1.主节点Master上安装spark"></a><a name="_Toc29839530"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">12.1.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">主节点</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Master</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">上安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">spark</span></a></h2><h3 id="12-1-1下载spark压缩包"><a href="#12-1-1下载spark压缩包" class="headerlink" title="12.1.1下载spark压缩包"></a><a name="_Toc29839531"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">12.1.1</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">压缩包</span></a></h3><p><span style="font-family:宋体; font-size:12pt">清华大学镜像站下载</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7.tgz</span><span style="font-family:宋体; font-size:12pt">文件</span><span style="font-family:宋体; font-size:12pt">，如图所示，其</span><span style="font-family:宋体; font-size:12pt">下载链接为：</span><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-2.4.4/spark-2.4.4-bin-hadoop2.7.tgz"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-2.4.4/spark-2.4.4-bin-hadoop2.7.tgz</span></a><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的安装路径是</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="font-family:'Times New Roman'; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="font-family:宋体; font-size:12pt">。首先进入安装目录</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">，使用</span><span style="font-family:'Times New Roman'; font-size:12pt">wget</span><span style="font-family:宋体; font-size:12pt">下载，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cd</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span>
<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">wget</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">https://mirrors.tuna.tsinghua.edu.cn/apache/spark/spark-2.4.4/spark-2.4.4-bin-hadoop2.7.tgz</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image091.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">下载</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span></div>

<h3 id="12-1-2-解压spark压缩包"><a href="#12-1-2-解压spark压缩包" class="headerlink" title="12.1.2.解压spark压缩包"></a><a name="_Toc29839532"><span style="font-family:黑体; font-size:12pt; font-weight:bold">12.1.2.解压</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">压缩包</span></a></h3><p><span style="font-family:宋体; font-size:12pt">解压</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">到当前文件夹，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tar</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">zvxf </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7.tgz</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image092.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">解压</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span></div>

<p><span style="font-family:宋体; font-size:12pt">解压完成后，删除原压缩包。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h3 id="12-1-3-修改spark配置文件"><a href="#12-1-3-修改spark配置文件" class="headerlink" title="12.1.3.修改spark配置文件"></a><a name="_Toc29839533"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">12.1.3.</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">修改</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">配置文件</span></a></h3><p><span style="font-family:宋体; font-size:12pt">配置文件路径为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/conf</span><span style="font-family:宋体; font-size:12pt">，如图所示</span><span style="font-family:宋体; font-size:12pt">，并且将</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-env.sh.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">template</span><span style="font-family:宋体; font-size:12pt">重命名为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-env.sh</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image093.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">然后修改</span><span style="font-family:宋体; font-size:12pt">配置文件</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-env.sh</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.4</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master ~]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/conf/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">env.sh</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image094.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">修改</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置文件</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark-env.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">sh</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">在末尾加上如下</span><span style="font-family:宋体; font-size:12pt">红色字体</span><span style="font-family:宋体; font-size:12pt">内容</span><span style="font-family:宋体; font-size:12pt">（其中</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">JAVA</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">HOME</span><span style="font-family:宋体; font-size:12pt">应与</span><span style="font-family:'Times New Roman'; font-size:12pt">java</span><span style="font-family:宋体; font-size:12pt">安装时的配置保持一致</span><span style="font-family:宋体; font-size:12pt">，黑色字体为注释</span><span style="font-family:宋体; font-size:12pt">），如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.4</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:Consolas; font-size:12pt">JAVA</span><span style="font-family:Consolas; font-size:12pt">_</span><span style="font-family:Consolas; font-size:12pt">HOME</span><span style="font-family:宋体; font-size:12pt">，一</span><span style="font-family:宋体; font-size:12pt">般</span><span style="font-family:宋体; font-size:12pt">来说，</span><span style="font-family:宋体; font-size:12pt">不</span><span style="font-family:宋体; font-size:12pt">配置也可以，但是可能会出现问题，</span><span style="font-family:宋体; font-size:12pt">最好还是配上<br></span>

<span style="font-family:Consolas; font-size:12pt"># </span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:Consolas; font-size:12pt">JAVA_HOME</span><span style="font-family:宋体; font-size:12pt">应与</span><span style="font-family:Consolas; font-size:12pt">java</span><span style="font-family:宋体; font-size:12pt">安装时的配置保持一致</span><span style="font-family:宋体; font-size:12pt">，见</span><span style="font-family:Consolas; font-size:12pt">6.2.4</span><span style="font-family:宋体; font-size:12pt">节<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> JAVA</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">HOME=/usr/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_64<br></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">一般来说，</span><span style="font-family:Consolas; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">任务有很大可能性需要去</span><span style="font-family:Consolas; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">上读取文件，所以配置上<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">如果说你的</span><span style="font-family:Consolas; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">就读取本地文件，也不需要</span><span style="font-family:Consolas; font-size:12pt">yarn</span><span style="font-family:宋体; font-size:12pt">管理，</span><span style="font-family:宋体; font-size:12pt">则</span><span style="font-family:宋体; font-size:12pt">不用配<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> HADOOP</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_CONF_DIR=/usr/local/hadoop-2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.7/etc/hadoop<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">设置</span><span style="font-family:Consolas; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">的主机名<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> SPARK</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">MASTER</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">HOST=master<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">提交</span><span style="font-family:Consolas; font-size:12pt">Application</span><span style="font-family:宋体; font-size:12pt">的端口，默认就是这个，万一要改</span><span style="font-family:宋体; font-size:12pt">就</span><span style="font-family:宋体; font-size:12pt">改这里<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> SPARK_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">MASTER</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">PORT=7077<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">每一个</span><span style="font-family:Consolas; font-size:12pt">Worker</span><span style="font-family:宋体; font-size:12pt">最多可以使用的</span><span style="font-family:Consolas; font-size:12pt">cpu core</span><span style="font-family:宋体; font-size:12pt">的个数，我虚拟机就一个</span><span style="font-family:Consolas; font-size:12pt">...<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">真实服务器如果有</span><span style="font-family:Consolas; font-size:12pt">32</span><span style="font-family:宋体; font-size:12pt">个，你可以设置为</span><span style="font-family:Consolas; font-size:12pt">32</span><span style="font-family:宋体; font-size:12pt">个<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> SPARK</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">WORKER</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_CORES=</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">1<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">&#xa0;<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">每一个</span><span style="font-family:Consolas; font-size:12pt">Worker</span><span style="font-family:宋体; font-size:12pt">最多可以使用的内存，虚拟机</span><span style="font-family:宋体; font-size:12pt">设置的是</span><span style="font-family:Consolas; font-size:12pt">2</span><span style="font-family:Consolas; font-size:12pt">G<br></span>

<span style="font-family:Consolas; font-size:12pt">#</span><span style="font-family:Consolas; font-size:12pt"> </span><span style="font-family:宋体; font-size:12pt">真实服务器如果有</span><span style="font-family:Consolas; font-size:12pt">128G</span><span style="font-family:宋体; font-size:12pt">，你可以设置为</span><span style="font-family:Consolas; font-size:12pt">100G<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> SPARK</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">WORKER</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">_</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">MEMORY=1g<br></span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="12-1-4-修改slaves文件"><a href="#12-1-4-修改slaves文件" class="headerlink" title="12.1.4.修改slaves文件"></a><a name="_Toc29839534"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">12.1.4.</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">修改</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">slaves</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">文件</span></a></h3><p><span style="font-family:宋体; font-size:12pt">如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.3</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">首先</span><span style="font-family:宋体; font-size:12pt">将</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">laves</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">.</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">template</span><span style="font-family:宋体; font-size:12pt">重命名为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">laves</span><span style="font-family:宋体; font-size:12pt">，然后修改</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">laves</span><span style="font-family:宋体; font-size:12pt">文件，删除或注释掉“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">localhost</span><span style="font-family:宋体; font-size:12pt">”，加入</span><span style="font-family:宋体; font-size:12pt">三台节点的主机名，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image095.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">修改</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">slaves</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">文件内容</span></div>

<h3 id="12-1-5-配置spark环境变量"><a href="#12-1-5-配置spark环境变量" class="headerlink" title="12.1.5.配置spark环境变量"></a><a name="_Toc29839535"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">12.1.5.</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">环境变量</span></a></h3><p><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">~</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">vi</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">加入如下内容：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> SPARK_HOME=/usr/local/spark-2.4.4-bin-hadoop2.7<br></span>

<span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> PATH=\$PATH:\$SPARK_HOME/bin:\$SPARK_HOME/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">bin</span>
</div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">配置完成后，使之生效，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.6</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">~</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">]# </span><span style="width:10.84pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">source</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> /etc/profile</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image096.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">并启动</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">输入以下命令</span><span style="font-family:宋体; font-size:12pt">启动</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.6</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">shell</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<h2 id="12-2-从节点上安装spark"><a href="#12-2-从节点上安装spark" class="headerlink" title="12.2.从节点上安装spark"></a><a name="_Toc29839536"><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">12.2.</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">从节点上安装</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">spark</span></a></h2><h3 id="12-2-1-scp传输spark安装文件"><a href="#12-2-1-scp传输spark安装文件" class="headerlink" title="12.2.1.scp传输spark安装文件"></a><a name="_Toc29839537"><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">12.2.1.scp</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">传输</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">安装文件</span></a></h3><p><span style="font-family:宋体; font-size:12pt">将主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上安装好的</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">利用</span><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传到从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">上，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> slave1:/usr/local</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scp</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">–</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">r </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> slave2:/usr/local</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：此处使用的是相对路径</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，因为当前目录为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt; font-weight:normal">/usr/local</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">，也可使用绝对路径。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">&#xa0;</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image097.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scp</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">传输</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">到从节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="12-2-2-配置spark环境变量"><a href="#12-2-2-配置spark环境变量" class="headerlink" title="12.2.2.配置spark环境变量"></a><a name="_Toc29839538"><span style="font-family:黑体; font-size:12pt; font-weight:bold">12.2.2.配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:黑体; font-size:12pt; font-weight:bold">环境变量</span></a></h3><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">节点配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">环境变量</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传输完成后</span><span style="font-family:宋体; font-size:12pt">，在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">，步骤同</span><span style="font-family:'Times New Roman'; font-size:12pt">1</span><span style="font-family:'Times New Roman'; font-size:12pt">2</span><span style="font-family:'Times New Roman'; font-size:12pt">.1.</span><span style="font-family:'Times New Roman'; font-size:12pt">5</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">节点上</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">配置完成后，输入以下命令启动</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">，如图所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@slave1 local]# </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">shell</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image098.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">并启动</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">（</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">）</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">2</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">节点配置</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">环境变量</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">scp</span><span style="font-family:宋体; font-size:12pt">传输完成后</span><span style="font-family:宋体; font-size:12pt">，在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave</span><span style="font-family:'Times New Roman'; font-size:12pt">2</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">配置</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">，步骤同</span><span style="font-family:'Times New Roman'; font-size:12pt">12.1.5</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">节点上</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">环境变量</span><span style="font-family:宋体; font-size:12pt">配置完成后，输入以下命令启动</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.9</span><span style="font-family:宋体; font-size:12pt">所示：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@slave2 local]# </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">-</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">shell</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image099.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">环境变量</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">并启动</span></div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">退出</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">时需</span><span style="font-family:宋体; font-size:12pt">输入</span><span style="font-family:宋体; font-size:12pt">“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">:quit</span><span style="font-family:宋体; font-size:12pt">”，上图是</span><span style="font-family:'Times New Roman'; font-size:12pt">spark-shell</span><span style="font-family:宋体; font-size:12pt">下的命令行，界面与</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">下的命令行不同，如图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image100.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">下的命令行</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h2 id="12-3-修改spark-env-sh"><a href="#12-3-修改spark-env-sh" class="headerlink" title="12.3.修改spark-env.sh"></a><a name="_Toc29839539"><span style="font-family:黑体; font-size:14pt; font-weight:bold">12.3.修改</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">spark-env.</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">sh</span></a></h2><p><span style="font-family:宋体; font-size:12pt">在每个节点上改正</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-env.sh</span><span style="font-family:宋体; font-size:12pt">的错误（如图</span><span style="font-family:'Times New Roman'; font-size:12pt">12.4</span><span style="font-family:宋体; font-size:12pt">），将最后一行“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">ecport</span><span style="font-family:宋体; font-size:12pt">”修改为</span><span style="font-family:宋体; font-size:12pt">“</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">export</span><span style="font-family:宋体; font-size:12pt">”。</span></p>
<p><span style="font-family:宋体; font-size:12pt">配置文件</span><span style="font-family:宋体; font-size:12pt">路径为</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/conf/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-env.sh</span><span style="font-family:宋体; font-size:12pt">，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image101.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">12.</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">改正</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">spark</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">-env.sh</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">配置文件</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<h1 id="13-启动Spark集群"><a href="#13-启动Spark集群" class="headerlink" title="13.启动Spark集群"></a><a name="_Toc29839540"><span style="font-family:黑体; font-size:16pt; font-weight:bold">13.启动</span><span style="font-family:'Times New Roman'; font-size:16pt; font-weight:bold">Spark</span><span style="font-family:黑体; font-size:16pt; font-weight:bold">集群</span></a></h1><p><span style="font-family:宋体; font-size:12pt">参考：</span><a target="_blank" rel="noopener" href="https://www.cnblogs.com/ZJdiem/p/11664634.html"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">https://www.cnblogs.com/ZJdiem/p/11664634.html</span></a></p>
<h2 id="13-1-说明"><a href="#13-1-说明" class="headerlink" title="13.1.说明"></a><a name="_Toc29839541"><span style="font-family:黑体; font-size:14pt; font-weight:bold">13.1.说明</span></a></h2><p><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">都是</span><span style="font-family:宋体; font-size:12pt">安装在</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">/usr/local</span><span style="font-family:宋体; font-size:12pt">文件夹下，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.1~13.3</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<p><span style="font-family:宋体; font-size:12pt">由于安装时是以</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">身份安装的，但操作</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">相关的东西时是以</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户，因此会产生权限的问题，所以需要登陆</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">账号，更改用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户</span><span style="font-family:宋体; font-size:12pt">，见</span><span style="font-family:'Times New Roman'; font-size:12pt">8.3</span><span style="font-family:宋体; font-size:12pt">节</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">从图中可以看到，</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">的所有者和用户组正常（因为安装</span><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">时已经修改过），而</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">的所有者和用户组则不对，后文修改。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image102.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">主节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image103.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.2</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">从节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image104.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.3</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">从节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">、</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">信息</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="13-2-更改Scala和Spark的用户组"><a href="#13-2-更改Scala和Spark的用户组" class="headerlink" title="13.2.更改Scala和Spark的用户组"></a><a name="_Toc29839542"><span style="font-family:黑体; font-size:14pt; font-weight:bold">13.2.更改</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Scala</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Spark</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">的用户组</span></a></h2><h3 id="13-2-1-主节点Master"><a href="#13-2-1-主节点Master" class="headerlink" title="13.2.1.主节点Master"></a><a name="_Toc29839543"><span style="font-family:黑体; font-size:12pt; font-weight:bold">13.2.1.主节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Master</span></a></h3><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">执行以下命令将</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">的安装目录的所有者和所属组改为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.4</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">master</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop /usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala-2.12.10</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@master local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop /usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span>
</div>

<p><span style="font-family:宋体; font-size:12pt; font-weight:bold">说明</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="font-family:宋体; font-size:12pt">由于前面安装</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">时已经更改过，因此只需要更改</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">安装目录的所有者和所属组</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.4</span><span style="font-family:宋体; font-size:12pt">所示。</span><span style="font-family:宋体; font-size:12pt">由图可知，</span><span style="font-family:宋体; font-size:12pt">修改前，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">2000</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">；修改后，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">、</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image105.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.4</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的用户组</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="13-2-2-从节点Slave1"><a href="#13-2-2-从节点Slave1" class="headerlink" title="13.2.2.从节点Slave1"></a><a name="_Toc29839544"><span style="font-family:黑体; font-size:12pt; font-weight:bold">13.2.2.从节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave1</span></a></h3><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">执行以下命令将</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">的安装目录的所有者和所属组改为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.5</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">lave1</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop /usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala-2.12.10</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@slave1 local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop /usr/local/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">由图可知，修改前，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组均为</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">；修改后，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image106.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.5</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的用户组</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h3 id="13-2-3-从节点Slave2"><a href="#13-2-3-从节点Slave2" class="headerlink" title="13.2.3.从节点Slave2"></a><a name="_Toc29839545"><span style="font-family:黑体; font-size:12pt; font-weight:bold">13.2.3.从节点</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Slave2</span></a></h3><p><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">执行以下命令</span><span style="font-family:宋体; font-size:12pt">（此处使用的是相对路径）</span><span style="font-family:宋体; font-size:12pt">将</span><span style="font-family:'Times New Roman'; font-size:12pt">Scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">的安装目录的所有者和所属组改为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户，如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.</span><span style="font-family:'Times New Roman'; font-size:12pt">6</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">scala-2.12.10</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[root@</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">slave2</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> local]# </span><span style="width:5.45pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">chown</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> -R hadoop:hadoop </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></div>

<p><span style="font-family:宋体; font-size:12pt">由图可知，修改前，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组</span><span style="font-family:宋体; font-size:12pt">均</span><span style="font-family:宋体; font-size:12pt">为</span><span style="font-family:'Times New Roman'; font-size:12pt">root</span><span style="font-family:宋体; font-size:12pt">；修改后，</span><span style="font-family:'Times New Roman'; font-size:12pt">scala</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">的用户组为</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image107.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.6</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Scala</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的用户组</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="13-3-启动Hadoop集群"><a href="#13-3-启动Hadoop集群" class="headerlink" title="13.3.启动Hadoop集群"></a><a name="_Toc29839546"><span style="font-family:黑体; font-size:14pt; font-weight:bold">13.3.启动</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Hadoop</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">集群</span></a></h2><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群之前必须先启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群。</span></p>
<p><span style="font-family:宋体; font-size:12pt">首先以</span><span style="font-family:'Times New Roman'; font-size:12pt">hadoop</span><span style="font-family:宋体; font-size:12pt">用户身份登陆，然后在主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">运行</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tart-dfs.sh</span><span style="font-family:宋体; font-size:12pt">启动</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">（此时各节点</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如表</span><span style="font-family:'Times New Roman'; font-size:12pt">13.1</span><span style="font-family:宋体; font-size:12pt">所示）</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">最后</span><span style="font-family:宋体; font-size:12pt">在从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:宋体; font-size:12pt">运行</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">s</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">tart-yarn.sh</span><span style="font-family:宋体; font-size:12pt">启动</span><span style="font-family:'Times New Roman'; font-size:12pt">YARN</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">（此时各节点</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如表</span><span style="font-family:'Times New Roman'; font-size:12pt">13.1</span><span style="font-family:宋体; font-size:12pt">所示）</span><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">如图所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image108.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.7</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span></div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image109.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.8</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<h2 id="13-4-启动Spark集群"><a href="#13-4-启动Spark集群" class="headerlink" title="13.4.启动Spark集群"></a><a name="_Toc29839547"><span style="font-family:黑体; font-size:14pt; font-weight:bold">13.4.启动</span><span style="font-family:'Times New Roman'; font-size:14pt; font-weight:bold">Spark</span><span style="font-family:黑体; font-size:14pt; font-weight:bold">集群</span></a></h2><p><span style="font-family:宋体; font-size:12pt; font-weight:bold">注意：启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群之前必须先启动</span><span style="font-family:'Times New Roman'; font-size:12pt; font-weight:bold">Hadoop</span><span style="font-family:宋体; font-size:12pt; font-weight:bold">集群。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">Hadoop</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">启动后，</span><span style="font-family:宋体; font-size:12pt">首先</span><span style="font-family:宋体; font-size:12pt">在</span><span style="font-family:'Times New Roman'; font-size:12pt">M</span><span style="font-family:'Times New Roman'; font-size:12pt">aster</span><span style="font-family:宋体; font-size:12pt">节点</span><span style="font-family:宋体; font-size:12pt">进入</span><span style="font-family:'Times New Roman'; font-size:12pt">spark</span><span style="font-family:宋体; font-size:12pt">目录，然后</span><span style="font-family:宋体; font-size:12pt">启动</span><span style="font-family:'Times New Roman'; font-size:12pt">S</span><span style="font-family:'Times New Roman'; font-size:12pt">park</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">，如图</span><span style="font-family:宋体; font-size:12pt">：</span></p>
<div style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; clear:both; margin:0pt">
<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">@master ~]</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt"> </span><span style="width:18.64pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">cd /usr/local/spark-2.4.4-bin-hadoop2.7</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[hadoop@master spark-2.4.4-bin-hadoop2.7]$</span><span style="width:13.9pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">sbin/start-master.sh</span>

<span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;<br></span>

<span style="font-family:宋体; font-size:12pt; font-weight:bold">输：</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">[</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">hadoop</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">@master </span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">spark-2.4.4-bin-hadoop2.7</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">]</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">$</span><span style="width:13.9pt; text-indent:0pt; display:inline-block"></span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">sbin/</span><span style="color:#ff0000; font-family:Consolas; font-size:12pt">start-slaves.sh</span>
</div>

<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image110.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.9</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群</span></div>

<p><span style="font-family:宋体; font-size:12pt">至此，</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">启动完成，此时主节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Master</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.9</span><span style="font-family:宋体; font-size:12pt">所示，从节点</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave1</span><span style="font-family:宋体; font-size:12pt">和</span><span style="font-family:'Times New Roman'; font-size:12pt">Slave2</span><span style="font-family:宋体; font-size:12pt">上</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.10</span><span style="font-family:宋体; font-size:12pt">所示，各节点集群启动前后</span><span style="font-family:'Times New Roman'; font-size:12pt">jps</span><span style="font-family:宋体; font-size:12pt">进程如表</span><span style="font-family:'Times New Roman'; font-size:12pt">13.1</span><span style="font-family:宋体; font-size:12pt">所示。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image111.png" alt="图片"><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image112.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.10</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">从节点</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave1</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">和</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<p><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">&#xa0;</span></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">表</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.1</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动集群后各节点上</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程</span></div>

<div style="text-align:center"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin:0 auto"><thead><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:44.25pt">

<span style="font-family:宋体; font-size:10.5pt; font-weight:bold">节点</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">名称</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">YARN</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span>
</td></tr></thead><tbody><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:44.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">master</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">J</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">ps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">NameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">J</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">ps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">NameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">J</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">ps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">NameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>

<span style="background-color:#ffff00; font-family:'Times New Roman'; font-size:10.5pt">Master</span><span style="background-color:#ffff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#ffff00; font-family:'Times New Roman'; font-size:10.5pt">Worker</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:44.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave1</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">SecondaryNameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">SecondaryNameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">SecondaryNameNode</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>

<span style="background-color:#ffff00; font-family:'Times New Roman'; font-size:10.5pt">Worker</span>
</td></tr><tr style="height:21.25pt"><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:44.25pt">

<span style="font-family:'Times New Roman'; font-size:10.5pt">slave2</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">ResourceManager</span><span style="background-color:#ff00ff; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>
</td><td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:131.5pt">

<span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">Jps</span><span style="background-color:#00ff00; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#00ff00; font-family:'Times New Roman'; font-size:10.5pt">DataNode</span>

<span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">ResourceManager</span><span style="background-color:#ff00ff; font-family:宋体; font-size:10.5pt">，</span><span style="background-color:#ff00ff; font-family:'Times New Roman'; font-size:10.5pt">NodeManager</span>

<span style="background-color:#ffff00; font-family:'Times New Roman'; font-size:10.5pt">Worker</span>
</td></tr></tbody></table></div>

<p><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">注：表中不同颜色代表启动不同集群后增加的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程，其中绿色为</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">HDFS</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群后增加的进程，洋红为</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Slave2</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">YARN</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群后增加的进程，绿色为</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Master</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">启动</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">集群后增加的进程；单元格内容为启动不同集群后各节点所有的</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">jps</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">进程。</span></p>
<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<p><span style="font-family:宋体; font-size:12pt">此时可在浏览器中打开</span><a target="_blank" rel="noopener" href="http://192.168.176.200:50070"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://192.168.176.20</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">0</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">:</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">8080</span></a><span style="font-family:宋体; font-size:12pt">，查看</span><span style="font-family:'Times New Roman'; font-size:12pt">Spark</span><span style="font-family:宋体; font-size:12pt">集群</span><span style="font-family:宋体; font-size:12pt">的管理界面</span><span style="font-family:宋体; font-size:12pt">，如</span><span style="font-family:宋体; font-size:12pt">下</span><span style="font-family:宋体; font-size:12pt">图</span><span style="font-family:'Times New Roman'; font-size:12pt">13.11</span><span style="font-family:宋体; font-size:12pt">所示</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><span style="font-family:宋体; font-size:12pt">同时，</span><span style="font-family:'Times New Roman'; font-size:12pt">HDFS</span><span style="font-family:宋体; font-size:12pt">的管理界面</span><span style="font-family:宋体; font-size:12pt">为</span><a target="_blank" rel="noopener" href="http://192.168.176.200:50070"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://192.168.176.200:50070</span></a><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">见</span><span style="font-family:'Times New Roman'; font-size:12pt">10.2</span><span style="font-family:宋体; font-size:12pt">节图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.5</span><span style="font-family:宋体; font-size:12pt">；</span><span style="font-family:'Times New Roman'; font-size:12pt">YARN</span><span style="font-family:宋体; font-size:12pt">的管理界面</span><span style="font-family:宋体; font-size:12pt">为</span><a target="_blank" rel="noopener" href="http://192.168.176.200:50070"><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">http://192.168.176.20</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">2</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">:</span><span style="color:#0000ff; font-family:'Times New Roman'; font-size:12pt; text-decoration:underline">8088</span></a><span style="font-family:宋体; font-size:12pt">，</span><span style="font-family:宋体; font-size:12pt">见</span><span style="font-family:'Times New Roman'; font-size:12pt">10.3</span><span style="font-family:宋体; font-size:12pt">节图</span><span style="font-family:'Times New Roman'; font-size:12pt">10.9</span><span style="font-family:宋体; font-size:12pt">。</span></p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/cluster-construction/image113.png" alt="图片"></p>
<div style="text-align:center"><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">图</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">13.11</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">   </span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">浏览器查看</span><span style="font-family:'Times New Roman'; font-size:10.5pt; font-weight:bold">Spark</span><span style="font-family:宋体; font-size:10.5pt; font-weight:bold">的管理界面</span></div>

<p><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span><br><span style="font-family:'Times New Roman'; font-size:12pt; color:#2F4F4F">&#xa0;至此，集群搭建完毕。</span><br><span style="font-family:'Times New Roman'; font-size:12pt">&#xa0;</span></p>
<div class="cnzz" style="display: none;">
<script src="https://s23.cnzz.com/z_stat.php?id=1277655852&web_id=1277655852" language="JavaScript"></script>
</div>
      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-license">
      <strong>文章作者： </strong><a href="https://hwame.top" style="color:#E541E5;"> 鴻塵</a>
    </li>
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://hwame.top/20200522/bigdata-cluster-with-hadoop-scala-spark.html" title="Hadoop集群搭建详细步骤" target="_blank" rel="external" style="color:#E541E5;">https://hwame.top/20200522/bigdata-cluster-with-hadoop-scala-spark.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用《<a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external" style="color:#E541E5;"><u>CC BY 4.0 CN协议</u></a>》许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://hwame.top" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://hwame.top" target="_blank"><span class="text-dark">鴻塵</span><small class="ml-1x">Pythoner, Data Analyst</small></a></h3>
        <div>个人简介：处女座不适合做码农。</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
      <div id="vcomments"></div>
    
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/20200523/centos7-environment-variables.html" title="CentOS7 环境变量详解"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    <li class="next">
      <a href="/20200522/configuration-of-nginx-and-uwsgi.html" title="Nginx配置与uWSGI配置详解"><span>下一篇&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
    <li class="toggle-toc">
      <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false" title="文章目录" role="button">
        <span style="color:#C71585">[&nbsp;</span><span style="color:#C71585">文章目录</span>
        <i class="text-collapsed icon icon-anchor"></i>
        <i class="text-in icon icon-close"></i>
        <span style="color:#C71585">]</span>
      </a>
    </li>
    
  </ul>
  
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,wechat,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  


</main>

  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/hwame" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/hwamei" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://www.zhihu.com/people/hwame" target="_blank" title="Zhihu" data-toggle=tooltip data-placement=top><i class="icon icon-zhihu"></i></a></li>
        
        <li><a href="https://segmentfault.com/u/hwame" target="_blank" title="Segmentfault" data-toggle=tooltip data-placement=top><i class="icon icon-segmentfault"></i></a></li>
        
        <li><a href="https://gitee.com/hwame" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2025 鴻塵
        
        
        <div class="publishby" style="font-family:Courier">
            <span id="busuanzi_container_site_pv">
                <i class="icon icon-eye"></i><span id="busuanzi_value_site_pv" style="font-family:Courier"></span>&nbsp;
                <i class="icon icon-users"></i><span id="busuanzi_value_site_uv" style="font-family:Courier"></span>
            </span>
            <!--
            <br>✯<a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/" style="color:#0FFFAA">鄂ICP备2020019329号</a>
            -->
            <br><i class="icon icon-clock" style="transform:rotate(90deg)"></i><span id="sitetime" style="font-family:Courier"></span>
        </div>
        
        <!--
        <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div>
        -->
    </div>
    
</footer>
<script>
    function siteTime(){
        window.setTimeout("siteTime()", 1000);
        var seconds = 1000;
        var minutes = seconds * 60;
        var hours = minutes * 60;
        var days = hours * 24;
        var years = days * 365;
        var today = new Date();
        var todayYear = today.getFullYear();
        var todayMonth = today.getMonth()+1;
        var todayDate = today.getDate();
        var todayHour = today.getHours();
        var todayMinute = today.getMinutes();
        var todaySecond = today.getSeconds();
        /* Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
        year - 作为date对象的年份，为4位年份值
        month - 0-11之间的整数，做为date对象的月份
        day - 1-31之间的整数，做为date对象的天数
        hours - 0(午夜24点)-23之间的整数，做为date对象的小时数
        minutes - 0-59之间的整数，做为date对象的分钟数
        seconds - 0-59之间的整数，做为date对象的秒数
        microseconds - 0-999之间的整数，做为date对象的毫秒数 */
        var t1 = Date.UTC(2020,05,19,21,20,52); //建站时间
        var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
        var diff = t2-t1;
        var diffYears = Math.floor(diff/years);
        var diffDays = Math.floor((diff/days)-diffYears*365);
        var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
        var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
        var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
        // 将「数字」转「补零字符串」
        var y = diffYears.toString()
        var d = diffDays.toString().padStart(3, '0')
        var h = diffHours.toString().padStart(2, '0')
        var m = diffMinutes.toString().padStart(2, '0')
        var s = diffSeconds.toString().padStart(2, '0')
        document.getElementById("sitetime").innerHTML=y+":"+d+":"+h+":"+m+":"+s;
    }
    siteTime();
</script>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<div id="go-top"></div>
<style type="text/css">
#go-top {
 width:40px;height:40px;
 background-color:#DDA0DD;
 position:relative;
 border-radius:20px;
 position:fixed;right:20px;bottom:50px;
 cursor:pointer;display:none;
}
#go-top:after {
 content:" ";
 position:absolute;left:14px;top:14px;
 border-top:2px solid #fff;border-right:2px solid #fff;
 width:12px;height:12px;
 transform:rotate(-45deg);
}
#go-top:hover {
 background-color:#8A2BE2;
}
</style>
<script>
$(function () {
  var top=$("#go-top");
  $(window).scroll(function () {
    ($(window).scrollTop() > 300) ? top.show(300) : top.hide(200);
    $("#go-top").click(function () {
      $('body,html').animate({scrollTop:0});
      return false();
    })
  });
});
</script>

<script src="/js/plugin.min.js"></script>


<script src="/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/js/insight.js"></script>





   




   
    

  <script src='/waline.js'></script>
  <link rel="stylesheet" type="text/css" href="/waline.css" />
  
  <script type="text/javascript">
 
  
Waline.init({
      el: '#vcomments',
      serverURL: 'https://waline.hwame.top',
});
  </script>

     


<!-- 20201211添加判断 -->

   
  <script src="//cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script>
  <script>
  //利用 FancyBox 实现点击图片放大
  $(document).ready(function() {
    $('article img').not('[hidden]').not('.panel-body img').each(function() {
      var $image = $(this);
      var imageCaption = $image.attr('alt');
      var $imageWrapLink = $image.parent('a');
      if ($imageWrapLink.length < 1) {
        var src = this.getAttribute('src');
        var idx = src.lastIndexOf('?');
        if (idx != -1) {
          src = src.substring(0, idx);
        }
        $imageWrapLink = $image.wrap('<a href="' + src + '"></a>').parent('a');
      }
      $imageWrapLink.attr('data-fancybox', 'images');
      if (imageCaption) {
        $imageWrapLink.attr('data-caption', imageCaption);
      }
    });
    $().fancybox({
      selector: '[data-fancybox="images"]',
      hash: false,
      loop: true,
    });
  });
  </script>







  
  <style>
    .copy-btn {
      display: inline-block;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      color: #333;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background-color: #eee;
      background-image: linear-gradient(#fcfcfc, #eee);
      border: 1px solid #d5d5d5;
      border-radius: 3px;
      user-select: none;
      outline: 0;
    }

    .highlight-wrap .copy-btn {
      transition: opacity .3s ease-in-out;
      opacity: 0;
      padding: 2px 6px;
      position: absolute;
      right: 4px;
      top: 8px;
      z-index: 2;
    }

    .highlight-wrap:hover .copy-btn,
        .highlight-wrap .copy-btn:focus {
      opacity: 1
    }

    .highlight-wrap {
      position: relative;
    }
  </style>
  
  <script>
    addLoadEvent(()=>{
      $('.highlight').each(function (i, e) {
        var $wrap = $('<div>').addClass('highlight-wrap')
        $(e).after($wrap)
        $wrap.append($('<button>').addClass('copy-btn').append('一键复制').on('click', function (e) {
          var code = $(this).parent().find(".code")[0].innerText
          
          var ta = document.createElement('textarea')
          document.body.appendChild(ta)
          ta.style.position = 'absolute'
          ta.style.top = '0px'
          ta.style.left = '0px'
          ta.value = code
          ta.select()
          ta.focus()
          var result = document.execCommand('copy')
          document.body.removeChild(ta)
          
            if(result)$(this).text('复制成功')
            else $(this).text('复制失败')
          
          $(this).blur()
        })).on('mouseleave', function (e) {
          var $b = $(this).find('.copy-btn')
          setTimeout(function () {
            $b.text('一键复制')
          }, 300)
        }).append(e)
      })
    })
  </script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ["$","$"], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
            processEscapes: true
        }
    });
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax();
        for (var i = 0; i < all.length; ++i)
            all[i].SourceElement().parentNode.className += ' has-jax';
    });
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body>
</html>